Home Forums Front-end Issues wp_query based on values in field group


wp_query based on values in field group

  • Hello

    I’ve got a Field Group that I’m attaching to all posts. I’m trying to structure my query based on one of the fields in the field group, but it’s not triggering.

    To make it work, I’m having to attach a new solo custom field, and populate it with values. This data becomes redundant with the field in the field group and also requires the content manager to add this single field to every post.

    Any guidance would be appreciated!

    This is my query code:

    $currentdate = date('Y-m-d');
    $wp_query = new WP_Query(  array ('showposts' => 30,
                            'meta_query'=> array(
                                  'key' => 'Event Date',
                                  'compare' => '>=',
                                  'value' => $currentdate,
                                  'type' => 'DATE',
                            'meta_key' => 'Event Date',
                            'orderby' => 'meta_value',
                            'order' => 'ASC'

    After the query retrieves records and I’m in the loop, I can access the field group value:

    while (have_posts()) : the_post(); 
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.