[wp-trac] [WordPress Trac] #22220: XML-RPC wp.editPost clears post categories
WordPress Trac
noreply at wordpress.org
Thu Oct 18 13:47:30 UTC 2012
#22220: XML-RPC wp.editPost clears post categories
-----------------------------+--------------------------
Reporter: yousefed | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: General
Version: | Severity: normal
Keywords: |
-----------------------------+--------------------------
According to http://codex.wordpress.org/XML-
RPC_WordPress_API/Posts#wp.editPost
"Only needs to contain fields that you wish to modify; all other fields
will retain their current values."
When I only post custom_fields to update the custom fields of a post
(custom post type by the way, didn't check for normal posts) the
categories of the post are removed (now "Unassigned").
I think the source of the problem might be the following part in
wp_insert_post:
{{{
// Make sure we set a valid category.
if ( empty($post_category) || 0 == count($post_category) ||
!is_array($post_category) ) {
// 'post' requires at least one category.
if ( 'post' == $post_type && 'auto-draft' != $post_status
)
$post_category = array(
get_option('default_category') );
else
$post_category = array();
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22220>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list