mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user