我有一个ID数组:
var_dump($userPostsInternal);
-> string(13) "128537,128545"
那我会的$args = array(
\'post__in\' => array($userPostsInternal),
\'post_type\' => \'post\',
\'posts_per_page\' => -1,
);
$q = new WP_Query( $args );
foreach ( $q->posts as $post ) {
$title = $post->title;
echo $title;
}
但我只有一个头衔。共有2篇文章,它们的ID与我们在var_dump();
我甚至试过:
foreach ( $q->posts as $post ) {
$title = get_the_title();
echo $title;
但我仍然只有一个头衔。如果我爆炸了$userPostsInternal
我明白了array(2) { [0]=> string(6) "128537" [1]=> string(6) "128545" }
根本没有结果