网站优化

网站优化

Products

当前位置:首页 > 网站优化 >

Wordpress发帖____无法运作

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