WordPress 中排除置顶文章,在 wordpress 的查询中设置参数:’post__not_in’ => get_option(‘sticky_posts’) 即可排除置顶文章,示例代码如下:

<?php
$recentPosts = new WP_Query(array('post__not_in' => get_option('sticky_posts')));
?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<li> <a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php echo get_the_title(); ?></a></li>
<?php endwhile; wp_reset_query();?>