Support

Account

Home Forums ACF PRO add related content to get_posts query Reply To: add related content to get_posts query

  • I don’t know what the code you posted is.

    What I mean is something along the lines of

    
    // get your posts
    $posts = get_posts(...);
    // loop through the posts and build list of related posts
    $related = array();
    foreach ($posts as $post) {
      $related = array_merge($related, get_field('related_posts', $post->ID));
    }
    $posts = array_merge($posts, $related);
    

    There are a number or ways you can do this depending on what you need. But there isn’t any configuration of arguments that will get all of the posts and all of the posts related to those posts in a single query.