Users: The 'who' parameter should not interfere with 'meta_key' + 'meta_value' in WP_User_Query.

Props adrianosilvaferreira.
Fixes #36724.

git-svn-id: https://develop.svn.wordpress.org/trunk@37360 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2016-05-04 18:56:58 +00:00
parent e415270afb
commit f3ccef62be
2 changed files with 54 additions and 7 deletions

View File

@@ -702,6 +702,37 @@ class Tests_User_Query extends WP_UnitTestCase {
$this->assertNotContains( self::$author_ids[2], $found );
}
/**
* @ticket 36724
*/
public function test_who_authors_should_work_alongside_meta_params() {
if ( ! is_multisite() ) {
$this->markTestSkipped( __METHOD__ . ' requires multisite.' );
}
$b = self::factory()->blog->create();
add_user_to_blog( $b, self::$author_ids[0], 'subscriber' );
add_user_to_blog( $b, self::$author_ids[1], 'author' );
add_user_to_blog( $b, self::$author_ids[2], 'editor' );
add_user_meta( self::$author_ids[1], 'foo', 'bar' );
add_user_meta( self::$author_ids[2], 'foo', 'baz' );
$q = new WP_User_Query( array(
'who' => 'authors',
'blog_id' => $b,
'meta_key' => 'foo',
'meta_value' => 'bar',
) );
$found = wp_list_pluck( $q->get_results(), 'ID' );
$this->assertNotContains( self::$author_ids[0], $found );
$this->assertContains( self::$author_ids[1], $found );
$this->assertNotContains( self::$author_ids[2], $found );
}
/**
* @ticket 32250
*/