I'm using WP_Query with ACF(Advanced Custom Fields)
I'm building a news portal, and I'm trying to pass related stories from 1 post which is top_story = true.
In another WP_Query I want to print the related articles to the post_id which is top_story and the id of that post, which normally can change.
My queries looks like this:
$args = array( 'posts_per_page' => 1, 'category_name' => 'News', 'meta_key' => 'top_story', 'meta_value' => 1 ); $the_query = new WP_Query( $args );
The secound query where I want to display the related articles from the post_id of the previous query is:
$ids = get_field('related_articles', false, false); $args = array( 'posts_per_page' => 2, 'post__in' => $ids, 'post_type' => 'post', 'post_id' => $post_id, 'category_name' => 'News'
I don't know if it's possible to pass the post_id from the 1st WP Query to the 2nd WP Query and print the related stories to that article with that post_id
I will be grateful if someone had the same issue and resolve it somehow