I am currently working on a project that involves scraping data from over 300 static pages and transferring that data into a WordPress site. I have set up various custom fields with the Simple Fields (http://simple-fields.com/) plugin, and have a basic XML-RPC connection working. Below is what I am using to test injecting custom posts (written in Ruby):
connection = XMLRPC::Client.new_from_uri "http://localhost:8888/xmlrpc.php"
username = "admin"
password = "password"
test_post = {
:post_type => "custom_property",
:post_status => "draft",
:post_title => "test post!",
:post_meta => {
:_simple_fields_fieldGroupID_1_fieldID_3_numInSet_0 => "test"
}
}
puts connection.call("wp.newPost", 1, username, password, test_post)
I have tried :custom_fields in place of :post_meta but still to no avail. I can’t seem to be able to update the custom fields that have been created through Simple Fields.
If anyone has any suggestions on what to do, it would be greatly appreciated.
EDIT: This problem was solved by extending the XML-RPC functions using this article: http://kovshenin.com/2010/custom-xml-rpc-methods-in-wordpress/
It is actually quite tricky to figure out the structure of the WordPress post. If it is a custom field you want to post in, you should use the format below:
If it is custom taxonomy, use this:
For terms you always need to put the value into an array even if it’s just one item. Hope it helped.