About 6 months ago there was an update to the WordPress API which allows setting a post's thumbnail (or featured) image.
http://www.maxcutler.com/2012/04/04/xml-rpc-in-wordpress-3-4/
I'm trying to use it but it's not working for me. I'd like to know what I may be doing wrong. I'm calling the XML-RPC newPost method to create a post and passing the Media ID of an existing asset in the media library (known as the attachment_id in the media library) The new post is being created and all the other properties are being set, except for the featured image.
I verified my version of the wordpress api, and sure enough in class-wp-xmlrpc-server.php I see the comment in the new post function section: "* post_thumbnail - ID of a media item to use as the post thumbnail/featured image"
All the other properties are working. I can add new images to the media library via XML-RPC. I can create and update posts and set their tags, titles, descriptions, custom field values, and categories. I don't get any errors when I try to set the post_thumbnail value. Even if I pass in a non-existent media id, which seems odd.
I was trying to do the same with my Ruby script and using XML RPC API.
First Initialize and get connect to your wordpress site:
Upload an image which you want as featured image.
get attachment id using
getMediaItem
method.Now create a post using
newPost
methodCheck the result by
getPost
method which will return you the postYou should Refer the following links. These all are my findings when I was facing the same issue:
arrrg! this WP version 3.4 ticket is misleading! http://core.trac.wordpress.org/ticket/20396
it's "wp_post_thumbnail" not "post_thumbnail"