I’ve an ajax operate that runs the next WP_User_Query
:
$args2 = array(
'meta_query' => array(
'gender' => array(
'key' => 'gender',
'worth' => 'feminine',
'examine' => '='
)
),
'quantity' => 10
);
$user_query = new WP_User_Query( $args2 );
The question is returning unfiltered outcomes, mainly ignoring the meta_query
. It really works superb if I run it from features.php
or from a template file, however not from ajax
. Any concept why?
That is the request
string when it really works:
SELECT SQL_CALC_FOUND_ROWS wp_users.ID
FROM wp_users INNER JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id
)
WHERE 1=1 AND (
( wp_usermeta.meta_key = 'gender' AND wp_usermeta.meta_value="feminine" )
)
ORDER BY user_login ASC
LIMIT 0, 10
And that is the one from the ajax operate:
SELECT SQL_CALC_FOUND_ROWS wp_users.ID
FROM wp_users
WHERE 1=1
ORDER BY user_login ASC
LIMIT 0, 10