WordPress.org

Make WordPress Core

Changeset 5739


Ignore:
Timestamp:
06/20/07 22:06:29 (8 years ago)
Author:
ryan
Message:

Don't create '0' categories. fixes #4413

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r5726 r5739  
    797797    if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories)) 
    798798        $post_categories = array(get_option('default_category')); 
     799    else if ( 1 == count($post_categories) && '' == $post_categories[0] ) 
     800        return true; 
    799801 
    800802    $post_categories = array_map('intval', $post_categories); 
  • trunk/wp-includes/taxonomy.php

    r5728 r5739  
    382382 
    383383    if ( is_int($term) ) { 
     384        if ( 0 == $term ) 
     385            return 0; 
    384386        $where = "t.term_id = '$term'"; 
    385387    } else { 
     
    601603        return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); 
    602604 
     605    if ( is_int($term) && 0 == $term ) 
     606        return new WP_Error('invalid_term_id', __('Invalid term ID')); 
     607 
    603608    $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); 
    604609    $args = wp_parse_args($args, $defaults); 
Note: See TracChangeset for help on using the changeset viewer.