From 91971b28a7ebcf02f44a544bca9888898b5464a8 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 12 Apr 2014 19:04:15 +0000 Subject: [PATCH] User Query: Don't blindly re-append new meta queries for capabilities. fixes #21119. Built from https://develop.svn.wordpress.org/trunk@28087 git-svn-id: http://core.svn.wordpress.org/trunk@27918 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/user.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index b9b50dd485..5a9dc466ac 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -665,7 +665,9 @@ class WP_User_Query { $cap_meta_query['compare'] = 'like'; } - $qv['meta_query'][] = $cap_meta_query; + if ( empty( $qv['meta_query'] ) || ! in_array( $cap_meta_query, $qv['meta_query'], true ) ) { + $qv['meta_query'][] = $cap_meta_query; + } } $meta_query = new WP_Meta_Query();