error with query
-
Hi,
I tried to gets custom post for filtering portfolio
I use
$loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => -1));
That return
[request] => SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'portfolio' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC
And if I’m logged as admin, I can see the “confidential” item
But if I’m logged as subscriber in the group confidential the query is now:
[request] => SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'portfolio' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 16 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC
And I don’t get the confidential items even the group as access to them
The problem is the “AND” in the query instead of “OR” wp_posts.post_status = ‘private’.Any idea hoe to display the items to the group?
- The topic ‘error with query’ is closed to new replies.