Do not check for a meta value in XML-RPC set_custom_fields unless we know we are editing a key. Prevents a notice when a custom field is being deleted. props scott.gonzalez. fixes #20543.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-04-25 14:26:31 +00:00
parent 103ecdf368
commit 58050466eb

View File

@ -276,11 +276,11 @@ class wp_xmlrpc_server extends IXR_Server {
if ( isset($meta['id']) ) {
$meta['id'] = (int) $meta['id'];
$pmeta = get_metadata_by_mid( 'post', $meta['id'] );
$meta['value'] = stripslashes_deep( $meta['value'] );
if ( isset($meta['key']) ) {
$meta['key'] = stripslashes( $meta['key'] );
if ( $meta['key'] != $pmeta->meta_key )
continue;
$meta['value'] = stripslashes_deep( $meta['value'] );
if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) )
update_metadata_by_mid( 'post', $meta['id'], $meta['value'] );
} elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) {