Retrieve Custom Fields in custom Query?
-
I’m following this tutorial:
https://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-2-advanced-fields/
to create a checkbox group in a meta box.
The box is created, data is getting saved, custom sorts/filters working, etc…
But what I can’t for the life of me figure out, is how to go about creating a query with the custom fields.
My end goal is to create an archive page of posts that have a checkmark in the checkmark group.
This is what I have right now — where have I strayed?
$args = array ( 'post_type' => 'post', 'meta_query' => array ( array( 'key' => 'my_checkbox_group', 'value' => 'my_checkbox_value', ) ) ); $query = new WP_Query($args);
When I do print_r($query), there are no posts found for this query (and I verifed that I have several posts with “my_checkbox_value” checked…
Thoughts?
- The topic ‘Retrieve Custom Fields in custom Query?’ is closed to new replies.