mercredi 31 décembre 2014

Why query_vars get altered in WP_Query Object?


I am having problems when querying a WP_Query Object when a user has a role different than administrator


My WP_Query is this:



$query = new WP_Query( array(
'post_type' => 'custom_post_type',
'author' => $author_id,
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'value_id',
'value' => $value_id,
'compare' => 'LIKE',
),
),
'order' => 'ASC'

));


For some reason when the query is run by a user other than the administrator, this is the result:



WP_Query Object
(
[query] => Array
(
[post_type] => notification
[author] => 70
[meta_query] => Array
(
[relation] => AND
[0] => Array
(
[key] => value_id
[value] => 86
[compare] => LIKE
)

)

[order] => ASC
)

[query_vars] => Array
(
[post_type] => notification
[author] => 86 //<--- THIS SHOULD BE 70
[meta_query] => Array
(
[relation] => AND
[0] => Array
(
[key] => value_id
[value] => 86
[compare] => LIKE
)

)
[order] => ASC
...


Please notice the author in query_vars it is 86 when it should be 70. Why is this being altered?





Aucun commentaire:

Enregistrer un commentaire