You wrote an important announcement. A welcome message. A “please read this first” note. You pinned it to the top of your blog. It stayed there for weeks.
Then one day — it vanished. A newer postDynamic, time-based content (e.g., blog entries) displayed i... More took its place. Or worse, nothing is pinned anymore.
The WordPress Sticky PostA post pinned to the top of the blog page, overriding chrono... More feature seems simple. But when it breaks, it’s frustrating and confusing. This guide explains why sticky posts unpin themselves and how to fix it.
Sticky posts (also called “pinned posts”) are WordPress posts that stay at the top of your blog pageStatic content (e.g., "About Us," "Contact") not part of chr... More, regardless of publish date. They appear before newer posts.
How to set a sticky postA post pinned to the top of the blog page, overriding chrono... More:
Where they appear:
/blog)pre_get_posts with 'ignore_sticky_posts' => falseWhat they don’t affect:
WordPress allows multiple sticky posts. If PostDynamic, time-based content (e.g., blog entries) displayed i... More A and PostDynamic, time-based content (e.g., blog entries) displayed i... More B are both sticky, PostDynamic, time-based content (e.g., blog entries) displayed i... More B (newer) appears first — but PostDynamic, time-based content (e.g., blog entries) displayed i... More A should still be pinned below it.
The real problem: A newer postDynamic, time-based content (e.g., blog entries) displayed i... More was accidentally set as sticky, pushing your original pinned postDynamic, time-based content (e.g., blog entries) displayed i... More down (sometimes below the fold, where you don’t see it).
How to check:
Fix: Remove sticky status from any postDynamic, time-based content (e.g., blog entries) displayed i... More that shouldn’t be pinned.
Not all themes respect sticky posts. Some blog themes ignore them entirely. Others use custom loops that bypass the sticky logic.
How to test:
Fix: Contact your themeTheme A collection of files that determine a site's design, ... More developer or modify your theme’s home.php or index.php to include:
php
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( is_sticky() ) : ?>
// Highlight or style sticky posts differently
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Some plugins interfere with sticky posts:
How to test:
Fix: Replace the conflicting pluginSoftware that adds specific features or functionality to a W... More or contact its support.
If you (or your themeTheme A collection of files that determine a site's design, ... More) use a custom WP_Query on the blog pageStatic content (e.g., "About Us," "Contact") not part of chr... More, sticky posts are ignored by default unless you explicitly tell WordPress to include them.
Problem code:
php
$custom_query = new WP_Query(array(
'posts_per_page' => 10
// 'ignore_sticky_posts' defaults to 1 (ignore)
));
Fix: Add 'ignore_sticky_posts' => 0 to your query:
php
$custom_query = new WP_Query(array(
'posts_per_page' => 10,
'ignore_sticky_posts' => 0
));
Then display sticky posts separately:
php
<?php
$sticky = get_option('sticky_posts');
if (!empty($sticky)) {
$sticky_query = new WP_Query(array(
'post__in' => $sticky,
'ignore_sticky_posts' => 1
));
// Display sticky posts here
}
?>
Rare but possible. The sticky_posts option in your wp_options table may be corrupted or empty.
How to check via phpMyAdmin:
wp_options tableoption_name = 'sticky_posts'option_value should look like a:1:{i:0;s:3:"123";} (serialized array of postDynamic, time-based content (e.g., blog entries) displayed i... More IDs)Fix: If corrupted, manually set sticky posts:
sticky_posts rowoption_value to a:1:{i:0;s:3:"[POST_ID]";} (replace [POST_ID] with your actual postDynamic, time-based content (e.g., blog entries) displayed i... More ID)Alternative: Use WP CLI:
bash
wp option patch insert sticky_posts 123
Follow this checklist in order:
Step 1: Check if sticky posts are still set
Step 2: Check for multiple sticky posts
Step 3: Test with a default themeTheme A collection of files that determine a site's design, ... More
Step 4: Test with all plugins disabled
Step 5: Clear all caches
Step 6: Repair the databaseWhere all WordPress content, settings, and user data are sto... More
wp_optionsStep 7: Manually set sticky posts via code
Add to your theme’s functions.php temporarily:
php
function force_sticky_posts() {
update_option('sticky_posts', array(123)); // Replace 123 with your postDynamic, time-based content (e.g., blog entries) displayed i... More ID
}
add_action('init', 'force_sticky_posts');
After confirming it works, remove the code.
Document your sticky posts
Avoid multiple sticky posts
Test themeTheme A collection of files that determine a site's design, ... More changes on staging
Use a sticky postA post pinned to the top of the blog page, overriding chrono... More pluginSoftware that adds specific features or functionality to a W... More
For advanced control, consider:
Monitor your blog pageStatic content (e.g., "About Us," "Contact") not part of chr... More after each WordPress update
The sticky postA post pinned to the top of the blog page, overriding chrono... More feature is simple but fragile. Most “broken” sticky posts aren’t actually broken — they’re just overridden by another sticky postA post pinned to the top of the blog page, overriding chrono... More or ignored by a themeTheme A collection of files that determine a site's design, ... More that doesn’t support them.
Remember:
When your pinned postDynamic, time-based content (e.g., blog entries) displayed i... More unpins itself, start with the simplest check: did someone (or something) set another postDynamic, time-based content (e.g., blog entries) displayed i... More as sticky? Nine times out of ten, that’s the answer.