Support

Account

Home Forums ACF PRO Getting childs of more than one page within an relationship acf field

Helping

Getting childs of more than one page within an relationship acf field

  • I’m using a relationship acf field… I make relation with all the childpages of a page. I do this within the functions.php of my theme:

    function my_relationship_query($args,$field,$post)
    {
    // 225 is the id of de page where the childs are
    $args[‘post_parent’] = ‘225’;
    return $args;
    }
    add_filter(‘acf/fields/relationship/query’, ‘my_relationship_query’, 10, 3);

    This works fine! But now I want multiple pages childs in mij relationship acf field:

    I’ve tried to get childs of multiple pages 225 and 83263
    This one doesn’t work:
    $args = array(‘post_type’ => ‘page’, ‘post_parent’ => array(‘225′,’83263’));

    And this one doesn’t work either:
    $args = array(‘post_type’ => ‘page’, ‘post_parent__in’ => array(225, 83263));

    Please can anyone help me. I’ve submitted a ticket but there’s sadly no respons from the ACF team.

  • I’ve made a workaround by creating an extra relationship field en fill this with the childs of a second page

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

The topic ‘Getting childs of more than one page within an relationship acf field’ is closed to new replies.