diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php index e77d68317..a47793b1e 100644 --- a/wp-admin/includes/taxonomy.php +++ b/wp-admin/includes/taxonomy.php @@ -79,25 +79,6 @@ function wp_create_categories($categories, $post_id = '') { return $cat_ids; } -/** - * Deletes one existing category. - * - * @since 2.0.0 - * - * @param int $cat_ID - * @return mixed Returns true if completes delete action; false if term doesnt exist; Zero on attempted deletion of default Category; WP_Error object is also a possibility. - */ -function wp_delete_category($cat_ID) { - $cat_ID = (int) $cat_ID; - $default = get_option('default_category'); - - // Don't delete the default cat - if ( $cat_ID == $default ) - return 0; - - return wp_delete_term($cat_ID, 'category', array('default' => $default)); -} - /** * Updates an existing Category or creates a new Category. * diff --git a/wp-includes/class.wp-xmlrpc-server.php b/wp-includes/class.wp-xmlrpc-server.php index 522bb839d..6aa9aa472 100644 --- a/wp-includes/class.wp-xmlrpc-server.php +++ b/wp-includes/class.wp-xmlrpc-server.php @@ -859,7 +859,7 @@ class wp_xmlrpc_server extends IXR_Server { * @since 2.5.0 * * @param array $args Method parameters. - * @return mixed See {@link wp_delete_category()} for return info. + * @return mixed See {@link wp_delete_term()} for return info. */ function wp_deleteCategory($args) { $this->escape($args); @@ -877,7 +877,7 @@ class wp_xmlrpc_server extends IXR_Server { if ( !current_user_can("manage_categories") ) return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) ); - return wp_delete_category( $category_id ); + return wp_delete_term( $category_id, 'category' ); } /** diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 27c527245..6dd504627 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1455,10 +1455,17 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) { $tt_id = $ids['term_taxonomy_id']; $defaults = array(); + + if ( 'category' == $taxonomy ) { + $defaults['default'] = get_option( 'default_category' ); + if ( $defaults['default'] == $term ) + return 0; // Don't delete the default category + } + $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); - if ( isset($default) ) { + if ( isset( $default ) ) { $default = (int) $default; if ( ! term_exists($default, $taxonomy) ) unset($default);