Do you want to exclude a sticky post from the loop in WordPress? You’re in the right place.
Sticky posts are a great way to highlight your featured content. However, in our opinion, there are certain places on your website where you don’t need sticky posts to be on the top.
In this article, we will show you how to completely exclude sticky posts from the loop in WordPress.
Why Should You Exclude Sticky Posts from the Loop?
Removing sticky posts from a loop on your WordPress website can be helpful if you don’t want to show them in a particular area on your WordPress website.
Sticky posts are useful in highlighting important content like your pillar articles, high-traffic blog posts, and time-sensitive content. However, they can crowd your most recent posts widget area and make your latest content harder to access.
This is where excluding sticky posts from the loop comes in handy. WordPress can not guess this so you need to explicitly tell WordPress to exclude sticky blog posts from a custom loop.
Let’s see how you can remove sticky posts from the loop in WordPress.
Excluding Sticky Posts from the Loop in WordPress
To help you exclude a sticky post from the top of the loop or completely remove them from the loop, we’ve created a custom code snippet.
Since this requires editing code on your website, it can be tricky for beginners. If you haven’t done this before, we recommend going through our guide on how to paste snippets from the web into WordPress for more details.
You might also consider hiring a developer for one-on-one help.
How to Ignore Sticky Posts in WordPress
This code ignores that a post is sticky and shows the posts in the normal order on your WordPress blog.
By using this code, your sticky posts will still appear in the loop, but they will not be placed on the top.
All you have to do is enter the following code to your theme’s functions.php file or in a code snippets plugin: