Make WordPress Core

Ticket #15008: 15008-2.2.diff

File 15008-2.2.diff, 2.3 KB (added by blepoxp, 14 years ago)

remove (int) cast

  • wp-admin/includes/taxonomy.php

     
    8080}
    8181
    8282/**
    83  * Deletes one existing category.
    84  *
    85  * @since 2.0.0
    86  *
    87  * @param int $cat_ID
    88  * @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 cat
    95         if ( $cat_ID == $default )
    96                 return 0;
    97 
    98         return wp_delete_term($cat_ID, 'category', array('default' => $default));
    99 }
    100 
    101 /**
    10283 * Updates an existing Category or creates a new Category.
    10384 *
    10485 * @since 2.0.0
  • wp-admin/includes/deprecated.php

     
    5555}
    5656
    5757/**
     58 * Deletes one existing category.
     59 *
     60 * @since 2.0.0
     61 * @deprecated 3.1
     62 * @deprecated use wp_delete_term()
     63 *
     64 * @param int $cat_ID
     65 * @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.
     66 */
     67function wp_delete_category($cat_ID) {
     68        _deprecated_function( __FUNCTION__, '3.1', 'wp_delete_term()' );
     69        return wp_delete_term( $cat_ID );
     70}
     71
     72/**
    5873 * {@internal Missing Short Description}}
    5974 *
    6075 * @since unknown
  • wp-includes/taxonomy.php

     
    14551455        $tt_id = $ids['term_taxonomy_id'];
    14561456
    14571457        $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       
    14581465        $args = wp_parse_args($args, $defaults);
    14591466        extract($args, EXTR_SKIP);
    14601467
    1461         if ( isset($default) ) {
     1468        if ( isset( $default ) ) {
    14621469                $default = (int) $default;
    14631470                if ( ! term_exists($default, $taxonomy) )
    14641471                        unset($default);