我创建了一个wordpress查询,并且试图排除ID为1293的帖子。
这是我到目前为止编写的查询:
<?php
$my_query = new WP_Query(array (
'post__not_in' => array(1293),
'post_type' => 'product',
'posts_per_page' => '100'
));
?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
最佳答案
post__not in
需要一个数组。请尝试以下操作:
$my_query = new WP_Query(array (
'post__not_in' => array(1293),
'post_type' => 'product',
'posts_per_page' => '100'
));
关于php - 从Wordpress查询中排除帖子ID,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21646333/