WordPress saves sticky posts inside the option named sticky_posts
. You can retrieve them via get_option('sticky_posts')
.
With that knowledge it is possible to change the query to only query for sticky posts, you usually do so via the pre_get_posts
hook.
add_action('pre_get_posts', 'WPSE_home_only_stickies');
function WPSE_home_only_stickies($query) {
// only run for homepage & main query
if ($query->is_home() && $query->is_main_query()) {
$sticky_posts = get_option('sticky_posts');
$query->set('post__in', $sticky_posts);
}
}
Related Posts:
- How to make my front page display only the most recent sticky post, plus usual widgets?
- Programmatically set page_on_front
- How to add “Stick this post to the front page” to front end?
- How do I show sticky posts on a static front page that also contains content?
- How do I set the front page programmatically?
- Custom background for the index page only?
- Load front-page.php from subfolder
- Can you select a post as the front page or only pages?
- Can’t edit front page of website [closed]
- How to block access to blog-page for users not logged in?
- Pagination not Working on only Front page on latest verson of WordPress
- Do I need an empty page for a different blog page?
- Showing option when page is frontpage
- Is it possible for homepage in Twentyseventeen theme to look like a standard page?
- Include sticky posts on the static page front page
- WordPress site front page fails to load in IE
- Home/front page won’t display content after a form is submitted
- how to create a static front page for my blog in wordpress
- Exclude all sticky posts front page twenty twelve
- Home link in the homepage of my wordpress does not show my blog posts
- WordPress, how to figure out how to edit front page
- How to set a static html front page
- Why: sticky front page code, shows latest non-sticky on logged-in front page
- NON Static-Front Page
- Front Page Settings
- What code controls the animation for the front-page header in TwentySeventeen
- Setting index.php as a static home page without posts?
- Implement a slideshow-like frontpage with text overlays
- Showing “best posts” in front page
- Pull in content from page defined as static front page
- Excluding front_page from is page condition
- Why does my site show the correct front-page when you arrive at the site, but not when you click ‘home’?
- Change Front Page Word Press 4.1
- custom change in front page [closed]
- Remove edit post link from static front page
- WordPress certain directories not connected
- Different front page for logged in and logged out user but the same URL in WordPress
- Homepage not working after setting as frontpage
- Hiding New Posts on Front Page
- change header height on 2017 theme for logged in users
- How to connect front-page.php to page in admin panel?
- Can I have two websites with one front page
- I created a new home page and set it as the home page in the reading section, but I get an error when typing in the home page url
- Categories with post from child categories on front page
- Static front page – going against the grain
- When Front page and Posts page are specified is it possible to just have front-page.php as the home page?
- Custom background for the index page only?
- No posts on front page
- Front page welcome message area
- Static front page as parent of with child pages?
- How did WordPress link an empty page at dashboard to an actual php file?
- why ignore_sticky_posts in sticky post query
- is_front_page() malfunction?
- Exclude sticky post from main query?
- Disable sticky posts feature
- Apply styling only to first page sticky posts
- All sticky posts are returned in custom query
- How to check if current static page is frontpage from admin plugin
- Can I hide a specific post from latest posts page?
- How do I make my single-work page show on my front-page.php?
- is_home() in HTML head
- Excluding Sticky Posts from The Loop and from WP_Query() in WordPress?
- How to target only the front page (not subsequent paginated pages) in theme/plugin?
- How to get 1 or 2 specific posts on top of my wordpress blog?
- Displaying recent post excerpts on static front page
- WordPress shows front page, when it should show 404 with pagination style urls
- Any Ideas for Including “More Tag” with get_pages($args)?
- Make sticky post on save
- Display post details by post ID
- Exclude first post (sticky or not) from the loop using query_posts()
- Custom query: how to get the sticky posts first?
- Display image for first sticky post only
- I would like to change the sticky posts label “Featured” to something else
- Why is my archive.php redirecting to front-page.php?
- What is the best way to build home pages with a lot of sections for distributable themes [closed]
- wordpress is_front_page() issue
- Accidentally deleted the ‘home’ page as my front page, can someone help?
- why can’t i add front.css to my frontpage.php
- How to create a custom WordPress front page
- How do I reference the front page’s parent Page object?
- How to create single page site in WordPress
- Create a frontpage.php and static page template
- Using a specific template for front page only
- wordpress query_posts featured page always on top
- How can I use my blog page as the homepage but only for mobile/tablet visits?
- Sticky Post Doesn’t always work
- How to show taxonomy on front page
- Make sticky post with FacetWP
- why ignore_sticky_posts in sticky post query
- Can I check who updated the static front page on WordPress and the time it was done
- Trying to Exclude Sticky Posts From date_query
- Blog Displays Only Sticky Posts
- Set custom field value when reaching expiration date
- adsense code showing on random post thumb
- Jquery and Sticky
- Reverse ordered pagination on home page
- Images for sticky posts
- How to access the so called “Posts page”
- First post outside of loop, homepage only?
- I make sticky post for my archive page for custom post type with ACF field and loop is not working