mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-27 16:54:30 +00:00
If category already exists, return its ID. Restores previous behavior. fixes #14067 for 3.1
git-svn-id: https://develop.svn.wordpress.org/trunk@15425 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
10
xmlrpc.php
10
xmlrpc.php
@@ -933,9 +933,15 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
"category_description" => $category["description"]
|
||||
);
|
||||
|
||||
$cat_id = wp_insert_category($new_category);
|
||||
if ( !$cat_id )
|
||||
$cat_id = wp_insert_category($new_category, true);
|
||||
if ( is_wp_error( $cat_id ) ) {
|
||||
if ( 'term_exists' == $cat_id->get_error_code() )
|
||||
return (int) $cat_id->get_error_data();
|
||||
else
|
||||
return(new IXR_Error(500, __("Sorry, the new category failed.")));
|
||||
} elseif ( ! $cat_id ) {
|
||||
return(new IXR_Error(500, __("Sorry, the new category failed.")));
|
||||
}
|
||||
|
||||
return($cat_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user