Using Checkboxes and Custom Meta Values With WP_Query

I had the hardest time (harder than it should have been anyway) trying to figure out how to filter my posts using WP_Query and the value of a checkbox (checked or not). As it turns out the value is “on”. See an example below of that and how to use multiple custom meta values to filter your content.

$args = array(
‘post_type’ => ‘athletes’,
‘posts_per_page’ => -1,
‘orderby’ => ‘menu_order’,
‘order’ => ‘ASC’,
‘meta_query’ => array(
array(
‘key’ => ‘dbt_gender’,
‘value’ => ‘male’
),
array(
‘key’ => ‘dbt_basketball’,
‘value’ => ‘on’
)

)
);

$the_query = new WP_Query( $args );

while ($the_query->have_posts()) : $the_query->the_post();

// DO YOUR LOOP MESS HERE!!!

endwhile;