Exclude Post ID from Wordpress Query
loops, php, wordpress
Solution
`post__not in` expects an array. Try the following:
$my_query = new WP_Query(array (
'post__not_in' => array(1293),
'post_type' => 'product',
'posts_per_page' => '100'
));
Problem
I have created a wordpress query and I am trying to exclude one post with the id of 1293. Here is the query I have written so far: ``` <?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(); ?> ```