pre_get_posts Remove posts based on meta value with ‘post__not_in’
Try this version: // Get all posts with the access level of ‘Member’ function members_get_member_posts() { $post_ids = wp_cache_get( ‘wpse61487_members_posts’ ); if ( false === $post_ids ) { $post_ids = array(); $args=array( ‘post_type’ => ‘any’, ‘meta_key’ => ‘_members_access_role’, ‘meta_value’ => ‘member’, ‘post_status’ => array(‘publish’,’private’) ); $protected_posts = get_posts($args); if($protected_posts) { $post_ids = wp_list_pluck( $protected_posts, ‘ID’ … Read more