WordPress.org

Make WordPress Core

Changeset 39578


Ignore:
Timestamp:
12/12/16 05:46:37 (8 months ago)
Author:
dd32
Message:

Taxonomy: Restore the ability to use string-based $args in wp_get_object_terms().

Props tyxla.
Fixes #39215

Location:
trunk
Files:
2 edited

Legend:

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

    r39475 r39578  
    18781878    $object_ids = array_map('intval', $object_ids); 
    18791879 
     1880    $args = wp_parse_args( $args ); 
     1881 
    18801882    $args['taxonomy'] = $taxonomies; 
    18811883    $args['object_ids'] = $object_ids; 
  • trunk/tests/phpunit/tests/term/wpGetObjectTerms.php

    r38667 r39578  
    691691        return $terms; 
    692692    } 
     693 
     694    public function test_verify_args_parameter_can_be_string() { 
     695        $p = self::factory()->post->create(); 
     696 
     697        $t1 = self::factory()->term->create( array( 
     698            'taxonomy' => $this->taxonomy, 
     699            'name' => 'AAA', 
     700        ) ); 
     701        $t2 = self::factory()->term->create( array( 
     702            'taxonomy' => $this->taxonomy, 
     703            'name' => 'ZZZ', 
     704        ) ); 
     705        $t3 = self::factory()->term->create( array( 
     706            'taxonomy' => $this->taxonomy, 
     707            'name' => 'JJJ', 
     708        ) ); 
     709 
     710        wp_set_object_terms( $p, array( $t1, $t2, $t3 ), $this->taxonomy ); 
     711 
     712        $found = wp_get_object_terms( $p, $this->taxonomy, 'orderby=name&fields=ids' ); 
     713 
     714        $this->assertEquals( array( $t1, $t3, $t2 ), $found ); 
     715    } 
    693716} 
Note: See TracChangeset for help on using the changeset viewer.