WordPress.org

Make WordPress Core

Ticket #18076: 18076.diff

File 18076.diff, 933 bytes (added by mdawaffe, 4 years ago)
  • wp-includes/taxonomy.php

     
    850850        } else { 
    851851                if ( is_object($term) ) 
    852852                        $term = $term->term_id; 
    853                 $term = (int) $term; 
     853                if ( !$term = (int) $term ) 
     854                        return $null; 
    854855                if ( ! $_term = wp_cache_get($term, $taxonomy) ) { 
    855                         $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) ); 
     856                        $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %d LIMIT 1", $taxonomy, $term) ); 
    856857                        if ( ! $_term ) 
    857858                                return $null; 
    858859                        wp_cache_add($term, $_term, $taxonomy);