Reputation: 1773
$posts_not_included = array( get_the_ID() );
$args = array(
'posts_per_page' => 3,
'posts__not_in' => $posts_not_included
);
query_posts($args);
I have this code in a single-post page. The page showcases a post, and then I try to call query_posts to get the other posts. However, the post I'm currently on is shown, despite the ID being shown by get_the_ID(); is correct. Am I doing something wrong? Do I need to use the WP_Query class instead?
Upvotes: 2
Views: 133
Reputation: 4356
Your parameter is wrong change it
$posts_not_included = array( get_the_ID() );
$args = array(
'posts_per_page' => 3,
'post__not_in' => $posts_not_included // right argument is post not posts
);
query_posts($args);
Upvotes: 3