X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/699231ae09f7057a4d0000cdf32e50a3df6a04ca..58f607a1de715c9bca69340a4d6fb9e1b9c2bed2:/xmlrpc.php diff --git a/xmlrpc.php b/xmlrpc.php index fd471f26..fdd670e2 100644 --- a/xmlrpc.php +++ b/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); }