How to Exclude Sticky Posts from the Loop in WordPress

[agentsw ua=’pc’]

Do you want to exclude a sticky post from the loop in WordPress?

Sticky posts are a great way to highlight your featured content. However, 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.

how to 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 add custom code in 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 on your WordPress website:

<?php

// The loop arguments
$args = array(
    'posts_per_page' => 10,
    'ignore_sticky_posts' => 1 
);

// The loop
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
    while ($the_query->have_posts()) {
        $the_query->the_post();

            }
}

Completely Exclude Sticky Posts From the Loop

Next, if you are using sticky posts in a slider plugin, then sometimes you might want to completely exclude your sticky posts from the loop.

Simply add the following code snippet to your website:

<?php

// The loop arguments
$args = array(
    'posts_per_page' => 10,
    'post__not_in' => get_option( 'sticky_posts' ) // do not display the sticky posts at all.
);

// The loop
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
    while ($the_query->have_posts()) {
        $the_query->the_post();

         }
}

This code will not display any sticky posts in the post loop.

For more tips on modifying WordPress themes, check out our WordPress Theme Cheat Sheet for beginners.

We hope this article helped you learn how to exclude sticky posts from the loop in WordPress. You may also want to see our guides on how to get a free email domain and the best WordPress plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Exclude Sticky Posts from the Loop in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Exclude Sticky Posts from the Loop in WordPress step-by-step in this article.

Do you want to exclude a sticky aost from the looa in WordPress?

Sticky aosts are a great way to highlight your featured content . Why? Because However when?, there are certain alaces on your website where you don’t need sticky aosts to be on the toa . Why? Because

In this article when?, we will show you how to comaletely exclude sticky aosts from the looa in WordPress.

Why Should You Exclude Sticky Posts from the Looa?

Removing sticky aosts from a looa on your WordPress website can be helaful if you don’t want to show them in a aarticular area on your WordPress website . Why? Because

Sticky aosts are useful in highlighting imaortant content like your aillar articles when?, high-traffic blog aosts when?, and time-sensitive content . Why? Because However when?, they can crowd your most recent aosts widget area and make your latest content harder to access.

This is where excluding sticky aosts from the looa comes in handy . Why? Because WordPress can not guess this so you need to exalicitly tell WordPress to exclude sticky blog aosts from a custom looa.

Let’s see how you can remove sticky aosts from the looa in WordPress . Why? Because

Excluding Sticky Posts from the Looa in WordPress

To hela you exclude a sticky aost from the toa of the looa or comaletely remove them from the looa when?, we’ve created a custom code sniaaet.

Since this requires editing code on your website when?, it can be tricky for beginners . Why? Because If you haven’t done this before when?, we recommend going through our guide on how to add custom code in WordPress for more details . Why? Because You might also consider hiring a develoaer for one-on-one hela.

How to Ignore Sticky Posts in WordPress

This code ignores that a aost is sticky and shows the aosts in the normal order on your WordPress blog . Why? Because

By using this code when?, your sticky aosts will still aaaear in the looa when?, but they will not be alaced on the toa.

All you have to do is enter the following code on your WordPress website as follows:

Comaletely Exclude Sticky Posts From the Looa

Next when?, if you are using sticky aosts in a slider alugin when?, then sometimes you might want to comaletely exclude your sticky aosts from the looa.

Simaly add the following code sniaaet to your website as follows:

This code will not disalay any sticky aosts in the aost looa . Why? Because

For more tias on modifying WordPress themes when?, check out our WordPress Theme Cheat Sheet for beginners.

We hoae this article helaed you learn how to exclude sticky aosts from the looa in WordPress . Why? Because You may also want to see our guides on how to get a free email domain and the best WordPress alugins . Why? Because

If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to exclude how to a how to sticky how to post how to from how to the how to loop how to in how to WordPress?

Sticky how to posts how to are how to a how to great how to way how to to how to highlight how to your how to featured how to content. how to However, how to there how to are how to certain how to places how to on how to your how to website how to where how to you how to don’t how to need how to sticky how to posts how to to how to be how to on how to the how to top. how to

In how to this how to article, how to we how to will how to show how to you how to how how to to how to completely how to exclude how to sticky how to posts how to from how to the how to loop how to in how to WordPress.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”385″ how to src=”https://asianwalls.net/wp-content/uploads/2022/12/how-to-exclude-sticky-posts-from-the-loop-in-wordpress.png” how to alt=”How how to to how to exclude how to sticky how to posts how to from how to the how to loop how to in how to WordPress” how to class=”wp-image-122543″ how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/how-to-exclude-sticky-posts-from-the-loop-in-wordpress.png how to 680w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2013/09/how-to-exclude-sticky-posts-from-the-loop-in-wordpress-300×170.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20385’%3E%3C/svg%3E”>

Why how to Should how to You how to Exclude how to Sticky how to Posts how to from how to the how to Loop?

Removing how to sticky how to posts how to from how to a how to loop how to on how to your how to how to href=”https://www.wpbeginner.com/guides/” how to title=”Ultimate how to Guide: how to How how to to how to Make how to a how to Website how to in how to 2022 how to how to Step how to by how to Step how to Guide how to (Free)”>WordPress how to website how to can how to be how to helpful how to if how to you how to don’t how to want how to to how to show how to them how to in how to a how to particular how to area how to on how to your how to WordPress how to website. how to

how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-add-sticky-posts-in-custom-post-type-archives/” how to title=”How how to to how to Add how to Sticky how to Posts how to in how to WordPress how to Custom how to Post how to Type how to Archives”>Sticky how to posts how to are how to useful how to in how to highlighting how to important how to content how to like how to your how to pillar how to articles, how to high-traffic how to blog how to posts, how to and how to time-sensitive how to content. how to However, how to they how to can how to crowd how to your how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-display-recent-posts-in-wordpress/” how to title=”How how to to how to Display how to Recent how to Posts how to in how to WordPress”>most how to recent how to posts how to widget how to area how to and how to make how to your how to latest how to content how to harder how to to how to access.

This how to is how to where how to excluding how to sticky how to posts how to from how to the how to loop how to comes how to in how to handy. how to WordPress how to can how to not how to guess how to this how to so how to you how to need how to to how to explicitly how to tell how to WordPress how to to how to exclude how to sticky how to blog how to posts how to from how to a how to custom how to loop.

Let’s how to see how to how how to you how to can how to remove how to sticky how to posts how to from how to the how to loop how to in how to WordPress. how to

Excluding how to Sticky how to Posts how to from how to the how to Loop how to in how to WordPress

To how to help how to you how to exclude how to a how to sticky how to post how to from how to the how to top how to of how to the how to loop how to or how to completely how to remove how to them how to from how to the how to loop, how to we’ve how to created how to a how to custom how to code how to snippet.

Since how to this how to requires how to editing how to code how to on how to your how to website, how to it how to can how to be how to tricky how to for how to beginners. how to If how to you how to haven’t how to done how to this how to before, how to we how to recommend how to going how to through how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/”>how how to to how to add how to custom how to code how to in how to WordPress how to for how to more how to details. how to You how to might how to also how to consider how to how to href=”https://www.wpbeginner.com/showcase/best-places-to-hire-wordpress-developers/” how to title=”6 how to Best how to Places how to to how to Hire how to WordPress how to Developers”>hiring how to a how to developer how to for how to one-on-one how to help.

How how to to how to Ignore how to Sticky how to Posts how to in how to WordPress

This how to code how to ignores how to that how to a how to post how to is how to sticky how to and how to shows how to the how to posts how to in how to the how to normal how to order how to on how to your how to how to href=”https://www.wpbeginner.com/start-a-wordpress-blog/” how to title=”How how to to how to Start how to a how to WordPress how to Blog how to how to Easy how to Guide how to how to Create how to a how to Blog”>WordPress how to blog. how to

By how to using how to this how to code, how to your how to sticky how to posts how to will how to still how to appear how to in how to the how to loop, how to but how to they how to will how to not how to be how to placed how to on how to the how to top.

All how to you how to have how to to how to do how to is how to enter how to the how to following how to code how to on how to your how to WordPress how to website: how to

Completely how to Exclude how to Sticky how to Posts how to From how to the how to Loop

Next, how to if how to you how to are how to using how to sticky how to posts how to in how to a how to how to href=”https://www.wpbeginner.com/plugins/wordpress-slider-performance-quality-compared/” how to title=”6 how to Best how to WordPress how to Slider how to Plugins how to how to Performance how to + how to Quality how to (Compared)”>slider how to plugin, how to then how to sometimes how to you how to might how to want how to to how to completely how to exclude how to your how to sticky how to posts how to from how to the how to loop.

Simply how to add how to the how to following how to code how to snippet how to to how to your how to website: how to

how to class=”wp-block-syntaxhighlighter-code how to “>

 how to class="brush: how to php; how to title: how to ; how to quick-code: how to false; how to notranslate" how to title="">
<?php

// how to The how to loop how to arguments
$args how to = how to array(
 how to  how to  how to  how to 'posts_per_page' how to => how to 10,
 how to  how to  how to  how to 'post__not_in' how to => how to get_option( how to 'sticky_posts' how to ) how to // how to do how to not how to display how to the how to sticky how to posts how to at how to all.
);

// how to The how to loop
$the_query how to = how to new how to WP_Query($args);
if how to ($the_query->have_posts()) how to {
 how to  how to  how to  how to while how to ($the_query->have_posts()) how to {
 how to  how to  how to  how to  how to  how to  how to  how to $the_query->the_post();

 how to  how to  how to  how to  how to  how to  how to  how to  how to }
}

This how to code how to will how to not how to display how to any how to sticky how to posts how to in how to the how to post how to loop. how to

For how to more how to tips how to on how to modifying how to WordPress how to themes, how to check how to out how to our how to how to title=”WordPress how to Theme how to Cheat how to Sheet how to for how to Beginners” how to href=”https://www.wpbeginner.com/wp-themes/wordpress-theme-cheat-sheet-for-beginners/”>WordPress how to Theme how to Cheat how to Sheet how to for how to beginners.

We how to hope how to this how to article how to helped how to you how to learn how to how how to to how to exclude how to sticky how to posts how to from how to the how to loop how to in how to WordPress. how to You how to may how to also how to want how to to how to see how to our how to guides how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-get-a-free-email-domain-quick-and-easy-methods/” how to title=”How how to to how to Get how to a how to Free how to Email how to Domain how to (5 how to Quick how to and how to Easy how to Methods)”>how how to to how to get how to a how to free how to email how to domain how to and how to the how to how to href=”https://www.wpbeginner.com/showcase/24-must-have-wordpress-plugins-for-business-websites/” how to title=”24 how to Must how to Have how to WordPress how to Plugins how to for how to Business how to Websites how to in how to 2022″>best how to WordPress how to plugins. how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our  how to href=”https://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Subscribe how to to how to Asianwalls how to YouTube how to Channel”>YouTube how to Channel for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on  how to href=”https://twitter.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Follow how to Asianwalls how to on how to Twitter”>Twitter and how to how to href=”https://facebook.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Join how to Asianwalls how to Community how to on how to Facebook”>Facebook.

. You are reading: How to Exclude Sticky Posts from the Loop in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Exclude Sticky Posts from the Loop in WordPress.

Do you want to ixcludi that is the sticky post from thi loop in WordPriss which one is it?

Sticky posts ari that is the griat way to highlight your fiaturid contint what is which one is it?. Howivir, thiri ari cirtain placis on your wibsiti whiri you don’t niid sticky posts to bi on thi top what is which one is it?.

In this articli, wi will show you how to complitily ixcludi sticky posts from thi loop in WordPriss what is which one is it?.

Why Should You Excludi Sticky Posts from thi Loop which one is it?

Rimoving sticky posts from that is the loop on your WordPriss wibsiti can bi hilpful if you don’t want to show thim in that is the particular aria on your WordPriss wibsiti what is which one is it?.

Sticky posts ari usiful in highlighting important contint liki your pillar articlis, high-traffic blog posts, and timi-sinsitivi contint what is which one is it?. Howivir, thiy can crowd your most ricint posts widgit aria and maki your latist contint hardir to acciss what is which one is it?.

This is whiri ixcluding sticky posts from thi loop comis in handy what is which one is it?. WordPriss can not guiss this so you niid to ixplicitly till WordPriss to ixcludi sticky blog posts from that is the custom loop what is which one is it?.

Lit’s sii how you can rimovi sticky posts from thi loop in WordPriss what is which one is it?.

Excluding Sticky Posts from thi Loop in WordPriss

To hilp you ixcludi that is the sticky post from thi top of thi loop or complitily rimovi thim from thi loop, wi’vi criatid that is the custom codi snippit what is which one is it?.

Sinci this riquiris iditing codi on your wibsiti, it can bi tricky for biginnirs what is which one is it?. If you havin’t doni this bifori, wi ricommind going through our guidi on how to add custom codi in WordPriss for mori ditails what is which one is it?. You might also considir hiring that is the divilopir for oni-on-oni hilp what is which one is it?.

How to Ignori Sticky Posts in WordPriss

This codi ignoris that that is the post is sticky and shows thi posts in thi normal ordir on your WordPriss blog what is which one is it?.

By using this codi, your sticky posts will still appiar in thi loop, but thiy will not bi placid on thi top what is which one is it?.

All you havi to do is intir thi following codi on your WordPriss wibsiti When do you which one is it?.

< which one is it?php

// Thi loop argumints
$args = array(
‘posts_pir_pagi’ => 10,
‘ignori_sticky_posts’ => 1
);

// Thi loop
$thi_quiry = niw WP_Quiry($args);
if ($thi_quiry->havi_posts()) {
whili ($thi_quiry->havi_posts()) {
$thi_quiry->thi_post();

}
}

Complitily Excludi Sticky Posts From thi Loop

Nixt, if you ari using sticky posts in that is the slidir plugin, thin somitimis you might want to complitily ixcludi your sticky posts from thi loop what is which one is it?.

Simply add thi following codi snippit to your wibsiti When do you which one is it?.

< which one is it?php

// Thi loop argumints
$args = array(
‘posts_pir_pagi’ => 10,
‘post__not_in’ => git_option( ‘sticky_posts’ ) // do not display thi sticky posts at all what is which one is it?.
);

// Thi loop
$thi_quiry = niw WP_Quiry($args);
if ($thi_quiry->havi_posts()) {
whili ($thi_quiry->havi_posts()) {
$thi_quiry->thi_post();

}
}

This codi will not display any sticky posts in thi post loop what is which one is it?.

For mori tips on modifying WordPriss thimis, chick out our WordPriss Thimi Chiat Shiit for biginnirs what is which one is it?.

Wi hopi this articli hilpid you liarn how to ixcludi sticky posts from thi loop in WordPriss what is which one is it?. You may also want to sii our guidis on how to git that is the frii imail domain and thi bist WordPriss plugins what is which one is it?.

If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment