[wp-trac] [WordPress Trac] #24822: XMLRPC wp.editPost doesn't update existing keys

WordPress Trac noreply at wordpress.org
Tue Aug 27 21:12:41 UTC 2013


#24822: XMLRPC wp.editPost doesn't update existing keys
--------------------------+----------------------
 Reporter:  jmaimarc      |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  XML-RPC       |     Version:  3.3
 Severity:  normal        |  Resolution:  invalid
 Keywords:  has-patch     |
--------------------------+----------------------

Comment (by DrewAPicture):

 Replying to [comment:8 jmaimarc]:
 > <snip>
 > That means either the burden of storing the WP postmeta ids is on the
 remote application, or the remote application has to double the work by
 first fetching the post data via wp.getPost, parse out the custom fields,
 set the updated custom field array with id,key & value , and then send the
 wp.editPost back. That will cause response delay, increase bandwidth,
 potential routing errors, hurt kittens, etc. I'm not sure this is the most
 efficient way to do it.
 >
 > I'm also not sure what metadata security refers to. You mean data
 tainting?

 I hit this on a recent project when we noticed multiple values were being
 stored on the same meta key without overwriting. We used the exact
 suggestion @nacin made above about deleting the key first then re-writing
 the value and it works fine.

 Since our custom method was basically a clone of `wp.editPost()` and still
 leveraged `_insert_post()`, we had to effectively "flush" the key before
 trying to update it so that server-side `get_post_meta()` calls could
 return only the first (and now most-recent) value.

 There was no performance hit to my knowledge. As @nacin made pretty clear
 above:
 > The XML-RPC API is rich enough for whatever you need to do here, you
 just need to use it properly.

 In our case, we used a custom method brought in via the `xmlrpc_methods`
 filter.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24822#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list