WordPress.org

Make WordPress Core

Ticket #17646: cast_to_int.diff

File cast_to_int.diff, 693 bytes (added by simonwheatley, 4 years ago)

Cast the values of the array to int if the fields are ids or tt_ids

  • wp-includes/taxonomy.php

     
    18931893        } else if ( 'tt_ids' == $fields ) { 
    18941894                $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order"); 
    18951895        } 
     1896        if ( 'ids' == $fields || 'tt_ids' == $fields ) 
     1897                $terms = array_map( create_function( '$value', 'return (int) $value;' ), $terms ); 
    18961898 
    18971899        if ( ! $terms ) 
    18981900                $terms = array();