Re-Ordering WordPress Blog Posts: A Guide

A Guide to Re-Ordering WordPress Blog Posts

For a high end content management system, WordPress sure makes it difficult to implement seemingly simple functionality every now and then. If you’ve ever tried to change the default order of how blog posts appear on your site then I’m sure you can relate.

WordPress orders blog posts based on the date and time that they were published and there isn’t a built-in option available that lets you change that default order. Thankfully, there are a few ways to get the job done.

In this post, we’ll walk you through three different ways to re-order your blog posts and point you to relevant resources for more information. But before we begin, let’s get some basics out of the way.

The Problem With WordPress’ Default Post Order

Post sorting in WordPress is actually pretty straightforward and can be summed up in a few words: reverse chronological order. In simple English, this means that by default WordPress handles the post order based on the timestamp of when it was published.

In addition, there is a slight difference with how post sorting works on the WordPress frontend versus how it works on the backend.

For instance, if we have a blog post series on how to setup a WordPress blog from scratch then you have two different options for sorting the individual posts on your site’s backend – by title and by date.

1 by date

Sorting by title on the backend makes the post series easier to follow.

2 by title

Unfortunately, even this little bit of functionality isn’t available to us on the frontend by default. Here, the posts are listed in reverse chronological order i.e. they’re ordered by date, and there aren’t any options available to re-order them.

3 default sorting

Sure it may not be a problem all the time but when you’re publishing, say, a series of posts then this lack of functionality leads to poor UX design. Having your readers start at the end and read up is a bit much.

Thankfully, there are a few different ways you can re-order your blog posts and have them appear the way you want them to on the frontend.

4 Ways to Re-Order Your Blog Posts

One of the best things about WordPress is that there’s (almost) always a way to incorporate additional functionality. In this section, we’ll present three solutions to re-order your blog posts on the frontend – manual, coding, and plugin options.

Method 1: link to …/?order=asc

If for some reason you simply want to reverse the usual order of your blog posts then you can simply link to your blog page with this parameter added to the url: ?order=asc

That will have the affect of displaying your posts with the oldest first instead of the latest which is the default. For example, link to mysite.com/?order=asc and your posts will be displayed with the oldest first.

Top Article:  Best Slideshow Plugins for WordPress

This also works on any category or date based archive page. For example, you can link to a category page like this mysite.com/category/category-name/?order=asc and it will display your category of posts with the oldest first.

This is by far the simplest way to quickly reverse the order of your posts.

Method 2: Change the Post Dates Manually

Since WordPress orders blog posts based on their timestamp, the easiest way to force a different post order is to manually change each post’s date. This option allows you to enforce any order you want on a selected set of posts giving you more control over post sorting.

  1. Login to your WordPress admin panel and navigate to Posts > All Posts.
  2. Click on the post you want to have appear first i.e. at the top. You’ll be redirected to the Edit Post screen.
  3. I4 edit linkn the Publish box on the right-hand side of the screen, click on the Edit link next to the Published on: section.
  4. Note down the date and time the post was published on your site. In this case, the post was published on January 18, 2017 at 7:35 a.m.
  5. Navigate back to the All Posts screen. Select the post you want to have displayed next in line and, following Step 3, head over to its Published on: section and click the Edit link once again.
  6. 5 edit timestampChange the post’s Published on: timestamp to one that pre-dates the post that is ahead of it in the queue. Doing this ensures that this post will be published after the first post on the frontend. We’ll reset the timestamp on this date to January 18, 2017 at 7:34 a.m.
  7. Repeat Step 5 and Step 6 until all of the blog posts are in the order you want them in. Here’s how our post series looks now:

6 post series backend

Although this method is incredibly easy to implement, it becomes difficult to manage when you have a bunch of posts on hand that need reordering. Additionally, it’s ineffective when the timestamp is an important element of the post itself, for instance, in the case of news articles.

Method 3: Code Your Own Custom Solution

WordPress is an open-source content management system which means that you can take matters into your own hands by adding custom code to its core files. In the grand tradition of doing the bare minimum, we’ll add a simple function to the active theme’s file.

Note: Remember to create a backup of your entire site before you begin.

  • Login to your cPanel or FTP client and navigate to your active theme’s functions.php file. (It should be in the /wp-content/themes/active-theme directory.
  • Open the functions.php file in a text editor and add the following lines of code to it:
Top Article:  Best 'Coming Soon' Plugins & Themes for WordPress


function change_posts_order( $query ) {
if ( $query-is_home() && $query-is_main_query() ) {
$query-set( 'orderby', 'title' );
$query-set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', ' change_posts_order ' );

  • Save the file and refresh your site’s blog page. You’ll notice that the posts will be sorted by title on the frontend.

7 frontend preview

The downside of this method is that all of your posts will be ordered by title on the frontend. If you’re programming literate then you can customize the code to order a selection of posts only. And if you’re looking to take things even further, you can also create your own custom plugin to implement post sorting functionality.

Method 4: Use a Plugin

There’s a plugin for everything – even re-ordering blog posts on your WordPress site. Post Types Order and Intuitive Custom Post Order are both great, free solutions that tackle the post sorting problem. We’ll show you how you can get started with the Post Types Order plugin.

8 post types order

  • Login to your WordPress admin panel and head over to Plugins > Add New.
  • Search for the Post Types Order plugin in the Add Plugins screen. Install and activate it once you’ve found it.

9 install plugin

  • Once you’ve activated the plugin, head over to its settings page by navigating to Settings > Post Types Order.

10 general settings

  • Configure the plugins settings and click the Save Settings button to continue.
  • Head over to Posts > All Posts to begin re-ordering the blog posts.
  • Drag and drop the posts into whichever order you like. In the screenshot below, we’re simply arranging our post series in ascending order.

11 reorder

Once you’re done it should look something like this:

12 preview backend

The difference here is that the timestamp of the individual blog posts is unaffected. Even though the second post in the series was published an hour after the first post and the third post, it appears second in line. Whichever order you go with will automatically be set onto the frontend.

Conclusion

Although WordPress doesn’t offer options to re-order blog posts out of the box there are several ways you can get the job done on your own.

Depending upon the number of posts you want to reorder, the sorting order you wish to achieve, and your level of technical expertise, you can go with any one of the options we covered:

  1. Change the post’s dates manually if you only need to re-order a handful of posts.
  2. If you’d like to re-order all of your posts in alphabetical order then simply add in a few lines of code to your theme’s functions.php file.
  3. If you’re not particularly programming literate, use the Post Types Order plugin to drag and drop selected posts into place.

Do you have any questions about re-ordering blog posts in WordPress? Let us know in the comments section below!

Charlie has been building WordPress themes, reviewing web hosts and utilizing social media since their respective inceptions.

44 thoughts on “Re-Ordering WordPress Blog Posts: A Guide

  1. Cynthia says:

    Method 1 worked PERFECTLY. Easiest solution ever. I am thrilled. Thank you

  2. TOM PARHAM says:

    is it possible to hire someone for a large rearranging task? ( see blog). this would require someone to locate the blogs into categories that i alone could define.

    1. Hi Tom, we can’t help with that ourselves here, but you could try finding someone on Upwork?

  3. Tracey says:

    Hi! I really want to use method #3, but am not completely sure of where in the functions.php file I should be placing the code. Thanks!

    1. Hi Tracey, you can add this code to the bottom of the functions file after the last line of existing code.

      1. Tracey says:

        You are AWESOME! Thank you!!

  4. Sue says:

    Hi Thanks for the sdvice I am having two problems I have installed the plug in and that is working well on a page but I cant find a way to drag and drop posts from page 2 to page 1 for example. Also my attempts at changing the dates has not worked. Any advice would be aappreciated. Thanks Sue

    1. Hi Sue, On the All Posts page in the admin you will by default see a list of 20 posts per page. If you click the “Screen Options” tab at the top right of the screen (right under your username) you’ll see an option to increase the number of posts per page. This should make it easier to drag/drop posts across a wider range.

      I’m not sure why your attempts to change dates are not working. Are you telling me that you can’t update the publish dates on your post (i.e. it won’t save changes) or that changing the dates doesn’t change the order on the front end? If the latter perhaps try a hard refresh of the page…possibly a caching issue.

  5. Renee says:

    Hi

    I have a health blog regarding my chronic illness. I would like to add an additional page to my blog titled ‘as it happened’ and have my blog posts (from my home page) listed on this page in chronological order for my readers.

    Any suggestions?

    1. Hi Renee, the simplest approach in your case may be to simply add a link somewhere (in your main nav I guess) where you link to your home page with this appended to the link “?order=asc”. This has the effect of displaying your posts in reverse order with oldest first, e.g. if you blog homepage is mysite.com, then you would link to mysite.com/?order=asc.

      This should infact work for any blog list page such as a date or category archive, e.g. I can link to my how-to category like this wpdevshed.com/category/tips-tricks-and-tools/how-to/?order=asc and show all my oldest posts first.

      Perhaps you could create a special “As It Happened” category, add all the posts you want to highlite to this category and then link to it something like mysite.com/category/as-it-happened/?order=asc

      Hope this helps.

  6. Kent says:

    I came across your article when trying to solve this problem: I have two categories that I want on the front page… but I want the page to only display the posts from the first category by default. I still want to be able to display the posts from category 2 when selected. Currently, WP displays all posts regardless of category. Plugins can include/exclude certain categories on the front page, but this is not what I’m after here. I simply want one category’s posts to be displayed by default while still keeping the other category posts available on the home page. Any ideas? Thank you.

    1. Hi Kent, I’m not sure exactly what you are trying to achieve. You want only one category to display on the home page, but you want another category to display as well when selected? Can’t you use one of those plugins to limit the home page to the two particular categories and only add posts you want on the home page to those categories as appropriate? If I’m misunderstanding can you please elaborate. Cheers.

  7. Md monis says:

    Thanks for the article its very helpful

  8. Rosie says:

    Your post is really helpful! I did apply method 3 and it worked well. Btw, I have a question. What if I want to display my posts in alphabetical order? so which method is the most effective one?

    1. charles Charles Coxhead says:

      Hi Rosie, I havn’t thought about that option before. Can I ask what is the use case for alphabetical order? Check out this question on Stackexchange, it has a good explanation on how to do this: https://wordpress.stackexchange.com/questions/210817/make-loop-display-posts-by-alphabetical-order

  9. prasad aher says:

    thank you bro

  10. This has been so helpful. Option 2 didn’t work, but the plug in does. However, I have 70 blog posts across 4 page views within the admin panel.

    1. charles Charles Coxhead says:

      Hi, you can adjust the number of posts listed per page in the admin. Go to the “Screen Options” settings top right of the admin panel (right below your account name).

  11. Erin Canning says:

    This has been so helpful. Option 2 didn’t work, but the plug in does. However, I have 70 blog posts across 4 page views within the admin panel. I can drag around the posts within the first page view, and then within the second, etc., but how am I to move them between page views?

    1. Hi Erin, you can display more than 20 posts per page in the admin. To change the number displayed go to your posts page in the admin, then go to the Screen Options settings (see very top right of the screen), and change the number of posts per page to anything you like. Hope that helps.

  12. Deborah says:

    my posts have suddenly appeared in chronological order – the posts from 2016 are now on page 1 I have no idea how that changed, but can you help?

    1. Hi Deborah, that is very unusual. I can only imagine you have changed a setting somewhere, possibly in the Essential Grid plugin which you appear to have installed.

  13. Andrew says:

    This all seems clear but I can’t find my dashboard despite trying to follow instructions given on other sites. I think it’s quite difficult for people like yourself who know what you’re doing to comprehend how useless some of us are at IT! We need a step by step map to guide us to the start of the beginning too!

    1. Hi Andrew, you can access the WordPress admin panel at yoursite.com/wp-admin – you’ll need to enter your credentials to access the admin. Once logged in you will see the main dashboard with the navigation to all parts of the admin on the left hand side.

  14. Is this a typo? You write:
    $query-set( ‘orderby’, ‘title’ );
    $query-set( ‘order’, ‘ASC’ );

    Which I think should be:
    $query->set( ‘orderby’, ‘title’ );
    $query->set( ‘order’, ‘ASC’ );

  15. Pauline Lynne Isaksen says:

    Thank you! Adding the plug-in worked like a charm. Pauline Isaksen Bio-Me AS.

  16. Hello Charles, firstly thanks for this info. I assume this post order is a global instruction. I’d like my archived posts to start with post 1 and my live ongoing posts to be viewed with the most current on top – is that possible too?

    1. Hi Brian, I see you have posts organized by trip, e.g. https://2-cheeses-go-rolling.com/category/france-2017/ and there you are displaying the posts in chronological order which is the opposite from the default behaviour of WordPress. I don’t see you have a stream of latest posts anywhere (did I miss it?), but I gather you want to add this, to the front page perhaps(?), and there display the latest posts. How have you got your category pages to display in chronological order? Are you using some kind of plugin or did you customize the category page template? If the latter then you should be able to set your home page as the main blog page and it will display the latest posts in reverse chronological order like a regular blog.

  17. Merissa says:

    Hello, I cannot for the life of me get my blog posts to have the most recent posts on top. I have tried making them sticky, making sure the UTC matches my location, and making sure the published dates are accurate. Are the published dates the time stamp? From most resources I have read it seems like my format is backwards to what is the norm. I still have an editorial from 2014 featured on top and it is driving me nuts. Thank you in advance! Web design noob over here.
    Sincerely,
    Merissa

    1. Hi Merissa, that does sound very unusual. Default behaviour for WordPress is to display latest posts first. Yours do seem to be in the reverse order, and I can’t tell why that would be. I can only assume that the theme you are using has a setting for this somewhere or perhaps you had some customizations done at some point and the order was reversed. Have you reached out to the theme developer and asked them for help?

  18. Ali says:

    Hi Dear,
    i liked third method, it solved my problem. i have tried to use sticky post method but it didn’t help when i publish new post.. but when i used this plugin it is amazing..
    thank you for sharing this method.

  19. Lily says:

    Is there a way of ordering the bloggers name in alphabetical order down the side of the page

    1. Hi Lily, have you tried the various Author List widgets? I’m sure one of those will give you the option to display the list alphabetically.

  20. SteveH says:

    Post Types Order – does what it says and does what I wanted . Thanks for the suggestion.
    (I’m updating pre-existing notes and the new publication date is irrelevant but the sort order is important.)

  21. rakesh kumar says:

    Hi
    You have tackled post order in a very different way and solved almost all the problems that might appear in admin panel but you have only shown you two method to change the order in front end. suppose we want to add an extra field that define the chronological order in front end. Then I think this would be the most suitable method for all of us.

    Am i right ?

    1. I don’t understand? If you want the posts in chronological order (oldest first) why not just use the plugin or the functions method described above. If you want to customize the order for some reason why not just use the existing date field and change the dates on posts to suit the order you want? I don’t see the need to add a field…maybe I don’t understand your use case?

  22. Josh says:

    The title sort works well. I have implemented it using the pre_get_posts filter as you have it. However, this then stop any further sorting when click on sortable column headers. Is that the expected result?

  23. chris says:

    Hi Charles,

    How do I get the appearance of a blog post to show (top to bottom) the latest post at the top?

    1. Hi Chris, I’m not sure I understand your question. Reverse chronological order (latest at the top) is the default for blogs to display. Yours doesn’t do that?

  24. Brian Novak says:

    The function only seems to work for posts. How do you reorder pages

    1. Hi Brian, can you describe the scenario you have in mind? I’m a bit confused because pages don’t have a chronological order.

  25. Your article was helpful to me in getting the order on my Slider (which uses post images) the way I want it. The problem I now have is that directly under my slider, WordPress insists on putting images of each post one after the other with a “comment” sidebar. I don’t want these here, but if I have to have them, it would be nice to at least have the comment sidebar work. When you click on the comment sidebar, it makes the slider disappear and you only now have the single, separate images. Can you help me with this?

    1. Hi Richard, I see what you mean. It seems that the comment links do not link to the post comments form as you would expect, but instead link to a category page which is why the slider disappears. This is odd and seems to be a bug in the theme (unless you have altered the theme template?). Have you tried reaching out to the developer of the theme you are using? They’d be best place to advise on how to fix that.

      1. adnan akram says:

        Dear Please tell me a Guide Book or Online Free course for WordPress.
        As I want to learn wordPress.

Leave a Reply