I want to create my own custom posting interface for my Wordpress blog, my reason for this is because I post multiple articles, sometimes ranging from 100-150 articles per day, and I want to simplify the process of posting an article, like batch posting articles.
I did my research and I found that Wordpress XMLRPC and MetaWeblog API is what I need.
So I tried it and I successfully post an article to my blog using this code:
<?php
include("../wp-includes/class-IXR.php");
$client = new IXR_Client('http://www.example.com/xmlrpc.php');
$content['title'] = 'Test Draft Entry using MetaWeblog API';
$content['description'] = '<p>Hello World!</p>';
if (!$client->query('metaWeblog.newPost','', 'admin',’password’, $content, false)) {
die('An error occurred - '.$client->getErrorCode().":".$client->getErrorMessage());
}
echo $client->getResponse();
?>
But for each post that I create in my Wordpress blog requires several step:
Step 1: Create a new Background with a Background type of Youtube and enter the Youtube ID of this background.
Step 2: Add a new post and attach the previously published background to this post.
Step 3: Enter a custom field called artist_id in the custom field section and add an excerpt for this post, publish the post.
So, each article needs 3 steps. So my question is, how can I use the XMLRPC to perform these actions?
For adding excerpts use
For custom fields use
Background and youtube metaboxes will most likely add custom post meta. You can find the key for them from db or source code and use it in above code.