Skip to content
Advertisement

WordPress how to show all posts in the index page and exclude sticky posts

Since WordPress sticky posts feature allow the post checked as sticky in post publish panel to be placed at the top of the front page of posts.

I want to show all posts in index without sticky posts:

JavaScript

Advertisement

Answer

You could use pre_get_posts action hook to manipulate the query. Since you need to modify the query on your index.php, the you could use the is_home conditional check.

JavaScript

Code goes into the functions.php of your active theme.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement