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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.