[wp-xmlrpc] Updating Custom Fields Using metaWeblog.editPost

Daniel Jalkut jalkut at red-sweater.com
Tue Apr 7 15:14:40 GMT 2009


David, I'm following this topic closely as I have plans to use the  
Custom Fields API but haven't yet dug into it.

 From talking to Joseph Scott, I re-oriented my thinking a bit about  
how WordPress handles these fields.  I expected the fields would be  
very "post-centric", but in fact the field values are themselves more  
like little mini-posts that are referenced by the main post in question.

This explains why, as Burt suggests, you need to specify a specific  
field id when updating one. Just as you specify a post ID to update  
the post.

it also leads to the somewhat weird (to me) situation that custom  
fields can vary wildly across posts, and there is nothing to tie them  
together except the key names.  For instance, a "Mood" custom field  
value attached to one post has no spacial relationship to a "Mood"  
value attached to another.

Daniel

On Apr 7, 2009, at 10:54 AM, Burt Adsit wrote:

> I just assumed that the structure of 'id','key','value' for custom  
> fields in the function set_custom_fields() in xmlrpc.php meant 'post  
> id', 'key','value'. It doesn't mean that at all.
>
> wp is expecting the post meta id in the 'id' field. wp returns that  
> value when you get the post. It gives you the post meta  
> 'id','key','value' for the custom fields. Your edit post call needs  
> to use that 'id' value *not* the post id.



More information about the wp-xmlrpc mailing list