How to Add Tags when posting via PHP

  • Author
  • #681134


    Hey, I’m trying to figure out how to add tags/keywords (these terms are interchangeable, right?) when posting to my blog via PHP. Here is the function I’m using to post right now. It’s working great, but I want to programmatically add tags. Many thanks:

    function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories=array(1)){
    $categories = implode(“,”, $categories);
    $XML = “<title>$title</title>”.
    $params = array(”,”,$username,$password,$XML,1);
    $request = xmlrpc_encode_request(‘blogger.newPost’,$params);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    curl_setopt($ch, CURLOPT_URL, $rpcurl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    wpPostXMLRPC(“May 14, 2011”,’‘,””,admin,fakePassword);

    The blog I need help with is



    Sorry it messed up the formatting on the function call. Here is a simplified version of what it actually looks like:

    wpPostXMLRPC(“May 14, 2011″,allMyHTMLGoesHere,””,admin,fakePassword);


    Member – the picture of the Huckster at the top of the post was very disturbing – however if you are asking about this site:

    The site you are asking about does not seem to be hosted on WordPress.COM so you need to make friends over at WordPress.ORG the keepers of the software you are using.

    This site is for support of sites hosted on WordPress.COM. You should address your questions to WordPress.ORG the keepers of the software you are using:

    For more on the difference:



    If you are indeed referring to the site, then you’ll probably want to head over to the forums, which is for self-hosted WordPress installs.



    Oh, now I understand the difference. Sorry to shout out to the wrong side of the fence.

    Thanks a bunch.

    Also, yeah the things you find on google’s hot trends are pretty strange. Mike Huckabee, “heart attack grill”, gonorrhea, etc. I’m hoping to scare the public with their own curiosities.

    Take care,

The topic ‘How to Add Tags when posting via PHP’ is closed to new replies.