Changeset 15690
- Timestamp:
- 10/03/2010 07:29:44 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/taxonomy.php
r15688 r15690 81 81 82 82 /** 83 * Deletes one existing category.84 *85 * @since 2.0.086 *87 * @param int $cat_ID88 * @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.89 */90 function wp_delete_category($cat_ID) {91 $cat_ID = (int) $cat_ID;92 $default = get_option('default_category');93 94 // Don't delete the default cat95 if ( $cat_ID == $default )96 return 0;97 98 return wp_delete_term($cat_ID, 'category', array('default' => $default));99 }100 101 /**102 83 * Updates an existing Category or creates a new Category. 103 84 * -
trunk/wp-includes/class.wp-xmlrpc-server.php
r15648 r15690 860 860 * 861 861 * @param array $args Method parameters. 862 * @return mixed See {@link wp_delete_ category()} for return info.862 * @return mixed See {@link wp_delete_term()} for return info. 863 863 */ 864 864 function wp_deleteCategory($args) { … … 878 878 return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) ); 879 879 880 return wp_delete_ category( $category_id);880 return wp_delete_term( $category_id, 'category' ); 881 881 } 882 882 -
trunk/wp-includes/taxonomy.php
r15688 r15690 1456 1456 1457 1457 $defaults = array(); 1458 1459 if ( 'category' == $taxonomy ) { 1460 $defaults['default'] = get_option( 'default_category' ); 1461 if ( $defaults['default'] == $term ) 1462 return 0; // Don't delete the default category 1463 } 1464 1458 1465 $args = wp_parse_args($args, $defaults); 1459 1466 extract($args, EXTR_SKIP); 1460 1467 1461 if ( isset( $default) ) {1468 if ( isset( $default ) ) { 1462 1469 $default = (int) $default; 1463 1470 if ( ! term_exists($default, $taxonomy) )
Note: See TracChangeset
for help on using the changeset viewer.