Products
GG网络技术分享 2025-03-18 16:12 3
$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?
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);
Demand feedback