Support

Account

Home Forums Backend Issues (wp-admin) Meta_query for nested repeater field values in a cpt.

Unread

Meta_query for nested repeater field values in a cpt.

  • I have a cpt as a template for courses. Each course template can contain several courses. The courses are recorded in a repeater, which in turn contains a repeater for dates.
    I need to query all course template that have a course without a date. My existing code to query only the first course of each template is:

    $args = array(
    'post_type' => 'kurs-vorlage',
    'posts_per_page' => -1,
    'meta_query' => array(
    array(
    'key' => 'kurse_repeater_0_daten_0_datum',
    'compare' => '=',
    'value' => '',
    ),
    ),
    );

    Customization with the $ sign returns no results:
    $args = array(
    'post_type' => 'kurs-vorlage',
    'posts_per_page' => -1,
    'meta_query' => array(
    array(
    'key' => 'kurse_repeater_$_daten_0_datum',
    'compare' => '=',
    'value' => '',
    ),
    ),
    );

    How can the meta-query be changed to check all courses in a template for an empty first date field? Thanks!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.