[wp-xmlrpc] exposing and manipulating custom fields

Joseph Scott joseph at randomnetworks.com
Tue Nov 13 17:42:26 GMT 2007


On Nov 13, 2007, at 10:01 AM, Daniel Jalkut wrote:

> I'm a little uneasy about the use of an omission to imply "complete  
> deletion." For instance, I'm trying to put together a custom fields  
> service, and I have a typo that causes:
>
>  "custom_fields" = (
>        {id = 129; key = city; vaalue = Sacramento; },
>        {id = 130; key = city; vaalue = Sandy; }
>    )
>
> Now I've just wiped out all of the custom fields in my blog for  
> id's 129 and 130?


I probably didn't make my example very clear.  That would cause an  
update not a delete, because you provided the key field.  A second  
typo, like keeeey instead of key, along with the value typo would  
have caused a delete.


> Maybe a separate method would be better for adjustments to the  
> actual topology of custom fields, instead of overloading it SO much  
> in the post settings.
>
> In general, I'd like to think that posting a blog post can at worst  
> adversely affect THAT post.


Custom fields are always per post/page, there are no global custom  
fields.  Those ids are the custom field id, which I had to expose  
because that is how they are uniquely identified.  So even with typos  
in all the damage would still be limited to a single post.

With the goal of having it possible to add/update/delete as part of  
the existing methods the overloading mechanism seemed the most direct  
route to make that happen.  There are of course other ways to do  
that, we could use different post fields that would be analogous to  
individual methods: add_custom_fields, update_custom_fields,  
delete_custom_fields.


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




More information about the wp-xmlrpc mailing list