[wp-xmlrpc] exposing and manipulating custom fields

Joseph Scott joseph at randomnetworks.com
Mon Nov 12 22:58:40 GMT 2007


I've put together a patch for http://trac.wordpress.org/ticket/5148  
on exposing custom fields.  Below is the commentary I added to the  
ticket, which outlines the basic format of how it works:

=========

The attached diff exposes custom fields via wp.getPage and  
metaWeblog.getPost (and their friends). The new field is called  
"custom_fields" and an array of structs, with each struct containing  
three entries: id, key and value. Something like this:

     "custom_fields" = (
         {id = 129; key = city; value = Sacramento; },
         {id = 130; key = city; value = Sandy; }
     )

Custom fields can be added via wp.newPost/editPost and  
metaWeblog.newPost/editPost following the same general format. If a  
custom field entry included with a post contains an "id" value then  
an update is done. If there is no "id" then an add is done. If there  
is an "id" value and no "key" value then the custom field with that  
id is deleted.

I'm also open to the possibility of a wp.addCustomField(blog_id,  
post_id, key, value) style methods if discussions show that there is  
an interest and a reasonable use for them.



--
Joseph Scott
http://joseph.randomnetworks.com/




More information about the wp-xmlrpc mailing list