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

David Weiss dave at daveweiss.net
Tue Apr 7 18:46:30 GMT 2009


Daniel:

"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."

I'm not sure what you're saying here.  My understanding of custom  
fields is that by creating each field, you'll see the option to  
populate a field with the same name on a per post basis when using the  
UI.  That makes it easy to use a custom field in a template - you just  
have to know what the custom field is you want to display.

It's definitely not "normalized" data - as someone pointed out in  
another thread, a type-o in creating a custom field will cause some  
issues for you.  But for the time being, it would seem to me that  
knowing the field names should pretty much suffice for many users'  
needs.  A better future solution might be to forget about the meta_id  
for the custom fields, and do create/update/delete based only on the  
name of the 'key'.  Who really cares what the meta_id is anyway?  For  
post 'X', if I supply a field named "Y", create it if it doesn't  
exist, update it if it does.  To "delete" it, provide a null value for  
it, or do a lookup for it and remove the row from the table.

In my particular situation, doing a "get" on a post to discover the  
meta_ids only creates more server load and more load on the network.   
I have all the data I need in a local database, so being able to  
create/update/delete a custom field from a post would only take one  
POST to the server instead of a REQUEST and POST.

  


More information about the wp-xmlrpc mailing list