pre get posts query not obeying meta key
-
I don’t know why my custom taxonomy archive is displaying posts with the custom field “archives” and value “no”. Shouldn’t it only show those posts with a value of “yes”?
// Pre get posts example add_action( 'pre_get_posts', 'tax_public' ); function tax_public( $query ) { if ( is_taxonomy() && is_main_query() ) { $query->set('posts_per_page', 30); $query->set( 'orderby', 'date' ); $query->set('post__not_in', array(99999999999999999999999,99999999999999)); $query->set( 'meta_key', 'archives' ); $query->set( 'meta_value', 'yes' ); } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘pre get posts query not obeying meta key’ is closed to new replies.