Answer the question
In order to leave comments, you need to log in
Display specific posts WP_query?
Good day, dear experts. Basically I ran into a problem.
The task is to set the appropriate page IDs for the Wp_Query class, which are taken from the custom field, ACF Object field. Received page IDs.
What was done.
1. Page IDs are received - as numerical values int(151) int(91), etc.
2. I pass the value to the post__in parameter Looks like this 'post__in' => array($mypost1
) first ), and accordingly only one page is displayed.
<?php
$queryz = get_field('page_toarticles');
foreach ($queryz as $post) {
$mypost = $post->ID;
$mypost1 = strval($mypost);
$args = array(
'post_type' => 'page',
'post__in' => array($mypost)
)}
$myquery = new WP_Query($args);
var_dump($myquery);
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question