WordPress.org

Ready to get started?Download WordPress

Forums

XML-RPC function/hook for native tags (4 posts)

  1. fncll
    Member
    Posted 6 years ago #

    Is there a function/hook to post/read native WP tags through an XML-RPC connection?

  2. Andreas Norman
    Member
    Posted 5 years ago #

    I wish to know the answer to this question as well. As I know ScribeFire is able to post to my blog with tags I would like to know how.

    Can it be done? If so, how?

  3. Joseph Scott
    Member
    Posted 5 years ago #

    You can add/edit tags on a post via the mt_keywords field in the metaWeblog.newPost and metaWeblog.editPost XML-RPC methods.

  4. Andreas Norman
    Member
    Posted 5 years ago #

    function metaWeblog_newPost( $blogid, $title, $content, $tags, $category="") {
      global $g_id;
      global $g_passwd;
      global $g_blog_url;
    
      $client = new xmlrpc_client( "{$g_blog_url}");
      $f = new xmlrpcmsg("metaWeblog.newPost", // metaWeblog.newPost method
        array(
          new xmlrpcval("{$blogid}", "string"), // blogid.
          new xmlrpcval($g_id, "string"), // user ID.
          new xmlrpcval($g_passwd, "string"), // password
          new xmlrpcval( // body
              array(
                'title'        => new xmlrpcval($title, "base64"),
                'description'    => new xmlrpcval($content, "base64"),
                'category'    => new xmlrpcval($category, "base64"),
                'mt_keywords' => new xmlrpcval($tags, "base64")
            ), "struct"),
          new xmlrpcval(true, "boolean") // publish
        )
      );
    
      $f->request_charset_encoding = 'UTF-8';
    
      $response = $client->send($f);
      return $response;
    }

    I found this source code here. Works like a charm!

Topic Closed

This topic has been closed to new replies.

About this Topic