News

How To Make Sticky Posts Even Stickier In WordPress

Development News

As WordPress becomes more of a content management API and framework there are times when some of its legacy features are too mired in the context of “blog” to really be useful when it’s in use as a full content management system. Sticky posts are a great example. They only work on the index page (or custom blog page if you set your site up that way). ‘Stickiness’ isn’t just useful for the home page of a WordPress site but useful on individual category lists or archive pages, and even in the admin area.

If you want sticky posts to stick everywhere then adding the following code snippet to your functions.php file will work for you:

You can always add some extra conditional logic into the sticky_posts_query() function to restrict stickiness to the admin only, or to a certain category or archive. Go forth and play.