Home Forums General Issues Trouble Querying Posts for Checkbox


Trouble Querying Posts for Checkbox

  • I have a single checkbox with a checked value of ‘Yes’ and am trying to query posts that have that checkbox checked.

    This is the code I’m using:

    $args = array(
                    'numberposts' => 3,
                    'post_type' => 'resource',
                    'meta_key' => 'is_a_featured_resource',
                    'meta_value' => 'Yes'
    $the_query = new WP_Query( $args );

    However, I get no posts returned. I have verified that the posts are checked. Where did I go wrong?

  • Hi devprose


    'meta_value' => true

    I think the checkbox saves the values as true / false

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.