Skip to contentSkip to main navigation Skip to footer

Easy steps to change the posts order in WordPress Blog

You can ether install a plugin like

or add the next lines in the function.php file from your wordpress theme.

add_filter ( 'posts_orderby', 'custom_posts_order', 99, 1);
function custom_posts_order( $orderby) {
   if (is_category()){
     return 'post_modified DESC';


custom post order

I’ve changed the custom order from ‘post_date DESC’ to ‘post_modified DESC’ to have the latest modified articles in front.

Notice that I’ve added the category condition  ‘is_category’ which will change the posts order just for categories and not  for tags or other terms.

Hope this helps.

Next read: Installing Squirrly SEO Plugin on a new site

Install squirrly seo

Was This Article Helpful?


There are no comments yet

Leave a comment