Support

Account

Home Forums General Issues Filter cpt by subfield in functions.php

Unread

Filter cpt by subfield in functions.php

  • Hello,
    I’ve read several entries and tried multiple configurations, but my query isn’t returning any results. I want to filter a cpt by a true/false subfield that’s inside a group field.

    Here’s the latest iteration:

    $filtered_cpt = get_posts(array(
       'numberposts'   => -1,
       'post_type'     => 'cpt_name',
       'meta_query'	   => array(
          array(
             'key'      => 'group_field_name_$_subfield_name',
             'value'    => '1',
             'compare'  => '=',
          ),
       ),
    ));
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.