Make WordPress Core


Ignore:
Timestamp:
04/13/2015 01:20:57 AM (10 years ago)
Author:
SergeyBiryukov
Message:

wp_update_term() should check if get_term() returned null.

props dlh.
fixes #31954.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r32047 r32117  
    33663366    global $wpdb;
    33673367
    3368     if ( ! taxonomy_exists($taxonomy) )
    3369         return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
     3368    if ( ! taxonomy_exists( $taxonomy ) ) {
     3369        return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) );
     3370    }
    33703371
    33713372    $term_id = (int) $term_id;
    33723373
    33733374    // First, get all of the original args
    3374     $term = get_term ($term_id, $taxonomy, ARRAY_A);
    3375 
    3376     if ( is_wp_error( $term ) )
     3375    $term = get_term( $term_id, $taxonomy, ARRAY_A );
     3376
     3377    if ( is_wp_error( $term ) ) {
    33773378        return $term;
     3379    }
     3380
     3381    if ( ! $term ) {
     3382        return new WP_Error( 'invalid_term', __( 'Empty Term' ) );
     3383    }
    33783384
    33793385    // Escape data pulled from DB.
Note: See TracChangeset for help on using the changeset viewer.