Using get_posts to get posts based on a checkbox value with Advanced Custom Fields

OK, I found the answer here: WP Query post meta value Turns out you have to use the serialize php function due to how wordpress stores arrays in the database. function get_city_jobs() { $city = ($_GET[‘city’]); $city = trim(ucfirst($city)); $args = array( ‘post_type’ => ‘careers_post_type’, ‘numberposts’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘city’, … Read more

get_posts custom field

If you want to use post meta for setting which posts are displayd on the front page, then I would recommend saving the setting with a separate meta_key. So instead of pushing it to the your_fields save it with its own key. This means modifying your metabox content to have something like this, <input type=”checkbox” … Read more