WordPress.org

Make WordPress Core

Ticket #12344: 11319.diff

File 11319.diff, 604 bytes (added by jeremyclarke, 6 years ago)

Avoid php notices in wp_set_object_terms()

  • wp-includes/taxonomy.php

     
    15891589        if ( !is_array($terms) ) 
    15901590                $terms = array($terms); 
    15911591 
     1592        $old_tt_ids = array(); 
     1593        $tt_ids = array(); 
     1594        $term_ids = array(); 
     1595 
    15921596        if ( ! $append ) 
    15931597                $old_tt_ids =  wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids', 'orderby' => 'none')); 
    15941598 
    1595         $tt_ids = array(); 
    1596         $term_ids = array(); 
    1597  
    15981599        foreach ( (array) $terms as $term) { 
    15991600                if ( !strlen(trim($term)) ) 
    16001601                        continue;