Make WordPress Core


Ignore:
Timestamp:
12/16/2016 05:49:02 AM (7 years ago)
Author:
dd32
Message:

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

Props tyxla.
Merges [39578] to the 4.7 branch.
Fixes #39215.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/tests/phpunit/tests/term/wpGetObjectTerms.php

    r38667 r39611  
    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.