I am building a reviewing system for user-submitted posts on my website. I have a page called page-review.php which displays the oldest post of the "pending review" category. This is to ensure that every user-submission gets reviewed. There is only one post displayed on this page at a time.
$review_args = array( 'orderby' => 'post_date', 'order' => 'ASC', 'posts_per_page' => '1', 'cat' => 22, ); $review_query = new WP_Query($review_args);
After a post has been reviewed a new custom meta tag will be added to the post called reviewed_by. This meta tag contains an array of user IDs that have reviewed this post.
How do I make it so that my query checks if the custom meta reviewed_by has the current user's ID in it? And if it does find it in the reviewed_by array then it will show the next oldest post that doesn't have the user's ID in the custom meta.
I still can't seem to get it working. The content in reviewed_by looks like the following (it's an array converted to a string I believe)
This is an array where my user_id is 34.
$review_args = array( 'orderby' => 'post_date', 'order' => 'ASC', 'posts_per_page' => '1', 'cat' => 22, 'meta_query' => array( array( 'key' =>'reviewed_by', 'value' => $current_user_id, 'compare' => 'NOT IN' ) ) );