Need help? Check out our Support site, then


How to Add Tags when posting via PHP

  1. 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:

    <?php
    //DEFINE
    function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories=array(1)){
    $categories = implode(",", $categories);
    $XML = "<title>$title</title>".
    "<category>$categories</category>".
    $body;
    $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);
    curl_exec($ch);
    curl_close($ch);
    }
    //START
    wpPostXMLRPC("May 14, 2011",'',"http://thisiswhatwecareabout.com/xmlrpc.php",admin,fakePassword);
    ?>

    The blog I need help with is amusesmile.wordpress.com.

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

    //START
    wpPostXMLRPC("May 14, 2011",allMyHTMLGoesHere,"http://thisiswhatwecareabout.com/xmlrpc.php",admin,fakePassword);

  3. http://thisiswhatwecareabout.com/ - 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.

    http://en.forums.wordpress.com/topic/7-things-to-know-before-posting-in-wordpresscom-forums?replies=1

    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: http://wordpress.org/support/

    For more on the difference: http://support.wordpress.com/com-vs-org/

  4. If you are indeed referring to the site http://thisiswhatwecareabout.com/, then you'll probably want to head over to the WordPress.org forums, which is for self-hosted WordPress installs. http://wordpress.org/support/

  5. 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,

Topic Closed

This topic has been closed to new replies.

About this Topic