Fix the formatting of $taxonomies parameter of 'wp_get_object_terms' filter.

[38667] changed the way that the filter parameters are built. That
changeset didn't fully account for the pre-4.7 format of `$taxonomies`.

Props ig_communitysites.
Fixes #40154.

git-svn-id: https://develop.svn.wordpress.org/trunk@40290 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2017-03-14 18:41:26 +00:00
parent b9dd2c01f3
commit 3025ba4c8f
2 changed files with 20 additions and 1 deletions

View File

@@ -85,6 +85,25 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
}
}
/**
* @ticket 40154
*/
public function test_taxonomies_passed_to_wp_get_object_terms_filter_should_be_quoted() {
register_taxonomy( 'wptests_tax', 'post' );
register_taxonomy( 'wptests_tax_2', 'post' );
add_filter( 'wp_get_object_terms', array( $this, 'wp_get_object_terms_callback' ), 10, 3 );
$terms = wp_get_object_terms( 1, array( 'wptests_tax', 'wptests_tax_2' ) );
remove_filter( 'wp_get_object_terms', array( $this, 'wp_get_object_terms_callback' ), 10, 3 );
$this->assertSame( "'wptests_tax', 'wptests_tax_2'", $this->taxonomies );
}
public function wp_get_object_terms_callback( $terms, $object_ids, $taxonomies ) {
$this->taxonomies = $taxonomies;
return $terms;
}
public function test_orderby_name() {
$p = self::factory()->post->create();