I have three separate WP_Queries on a page. Each of them return custom post type items that have a certain checkbox checked and then display one of those randomly. The checkbox has been added using Custom Metaboxes and Fields for WordPress.
<?php $front1_args = array( 'post_type' => 'work-item', 'meta_key' => '_cmb_work_front_large', 'meta_value_num' => 1, 'orderby' => 'rand', 'posts_per_page' => '1' ); $front1_query = new WP_Query($front1_args); while ($front1_query->have_posts()) : $front1_query->the_post(); ?> <div> post content comes here </div> <?php endwhile; wp_reset_postdata(); ?>
However unpicking the checkbox on a certain post sometimes has no effect. The query still returns all items that at some point have had the checkbox checked regardless if they have it now. Setting
update_post_term_cache to false has no effect.
Any ideas what might cause this? Is this a cache issue at all, or is CMB maybe at fault?