mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Don't create '0' categories. fixes #4413
git-svn-id: https://develop.svn.wordpress.org/trunk@5739 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -381,6 +381,8 @@ function is_term($term, $taxonomy = '') {
|
||||
global $wpdb;
|
||||
|
||||
if ( is_int($term) ) {
|
||||
if ( 0 == $term )
|
||||
return 0;
|
||||
$where = "t.term_id = '$term'";
|
||||
} else {
|
||||
if ( ! $term = sanitize_title($term) )
|
||||
@@ -600,6 +602,9 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
|
||||
if ( ! is_taxonomy($taxonomy) )
|
||||
return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
|
||||
|
||||
if ( is_int($term) && 0 == $term )
|
||||
return new WP_Error('invalid_term_id', __('Invalid term ID'));
|
||||
|
||||
$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
|
||||
$args = wp_parse_args($args, $defaults);
|
||||
$args['name'] = $term;
|
||||
|
||||
Reference in New Issue
Block a user