Support

Account

Home Forums ACF PRO Query nested repeater fields

Helping

Query nested repeater fields

  • Hi all,

    I’m new to WP and ACF so I’m having trouble writing the proper query for what I’m trying to achieve.

    I have a custom post type called “guide” that contains many “sections” (repeaters). Those sections each contain a “section_title” (text) and a “section_posts” (repeater) fields.

    I would like to display the guide on a post if that post is part of a guide (in any of the sections).

    This is my current non-working query:

    
    $guides = get_posts(array(
      'numberposts' => '1',
      'post_type' => 'guide',
      'meta_query' => array(
        array(
          'key' => 'section_posts', // this is probably wrong
          'value' => '"' . get_the_ID() . '"',
          'compary' => 'LIKE'
    ));
    
  • This thread helped me figure out the answer. Make sure look at extrasmall’s answer to get it working.

    https://support.advancedcustomfields.com/forums/topic/reverse-query-relationship-subfield-which-is-nested-in-a-repeater-field/

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Query nested repeater fields’ is closed to new replies.