How to re-order WordPress blog posts

By default, WordPress posts are ordered based on the date that they were published. And if you’ve ever tried to re-order WordPress blog posts then you know full well that there’s no built-in way to do that.

However, if you do want to move a few posts around then there are three different methods to go about it – (1) manually changing the posts publish date, (2) writing code for a customized solution, or (3) using a plugin that’ll get the job done automatically.

With this in mind, in this post, we’ll step through all three of the options available to you for re-ordering your blog posts. But before we begin, let’s take a quick look at how WordPress handles the default post order.

Let’s get started.

How WordPress handles the default post order (and why it’s a problem)

In a nutshell, WordPress orders blog posts in reverse chronological order. This basically means that how your posts appear on the front-end depends entirely on when you published them. This example sums it up well:

WordPress' default sorting order

On the back-end interface, we have the option of sorting posts by both the post date and the post title. If you’ve ever published a series of blog posts then you know that sorting by title makes it much more intuitive to follow. However, even this seemingly tiny bit of blogging functionality is denied to us on the front-end.

Sort by title on the back-end

For instance, if you’ve published a series on setting up a WordPress blog then chances are you want the first post of the series to appear at the top of the list and not at the bottom. Not only does it improve the user experience your site delivers but it also makes it easier for the reader to follow the series in the order it was intended to be in.

Fortunately, there are a few ways you can re-order WordPress blog posts to appear in a more logical order on the front-end.

How to re-order WordPress blog posts

WordPress makes it easy for users to integrate additional, custom functionality into the core software. With that in mind, let’s step through three different ways you can re-order WordPress blog posts on the front-end. All three options have their own benefits and the one you ultimately decide to go with depends on your requirements and level of technical knowledge.

Option 1: Change the post dates manually

As we briefly mentioned above, posts with more recent timestamps come before those with older ones. The simplest (and most instinctive) way to re-order WordPress blog posts on the front-end is to change the post dates by hand.

The post's timestamp.

Start off by logging into your WordPress site’s admin panel and navigating to Posts > All Posts. Open the post you want at the top of your series in the Edit Post screen and note down the date and time of when it was published. In our example, the timestamp is February 22, 2017 at 10:19 a.m.:

Editing the post's timestamp.

Now, head back to Posts > All Posts and select the post you want to have appear next in line. Click on the Edit link in the “Published on” section and change the post’s timestamp so that it pre-dates the post that’s intended to be ahead of it in the series’ queue. Following our example, we’ll set the new timestamp to February 22, 2017 at 10:18 a.m. i.e. a minute before the preceding post.

Repeat the same process for all of the posts in your series. Here’s how it should look like on the back-end once you’re done:

Back-end preview of posts.

Changing the post dates manually is incredibly easy to implement if you have a handful of posts that need to be re-ordered. This option isn’t as effective when you have hundreds of posts to re-order or when the timestamp is an important element of the post.

Option 2: Add code for a custom solution

Since WordPress is open source, it allows developers to write custom code to integrate additional functionality to the core software – even if it’s to re-order WordPress blog posts. As always, remember to take a full backup of your site before you mess around with its files.

To get started, login to an FTP client and open up the active theme’s functions.php file by navigating to /wp-content/themes/ACTIVE-THEME/ from the root directory. Next, open up the functions.php file in a text editor of your choice (raw text editor, like Notepad; not MS Word) and insert the following lines of code at the bottom:

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

Once you’re done, be sure to save the file and re-upload it to your site’s themes directory. The result:

Posts sorted by title on the front-end.

Adding this code snippet allows you to re-order WordPress blog posts by title on the front-end. The only downside of using this code is that it will re-order all of your blog posts, permanently. You can, of course, customize it even further to re-order only a selected set of posts.

Option 3: Use the Post Types Order plugin

If you’ve been working with WordPress for some time now then you probably already know that there’s a plugin for (almost) everything. The Post Types Order plugin is a free solution that allows you to re-order WordPress blog posts by simply dragging and dropping them into place.

The first thing you’ll need to do is install and activate the Post Types Order plugin by navigating to Plugins > Add New from your WordPress admin panel.

Once it’s activated, head over to Settings > Post Types Order to configure the plugin’s settings. Here’s a preview of the General settings page:

General settings page preview.

Now, navigate to Posts > All Posts to start re-ordering the blog posts. All you have to do is drag and drop the posts into whichever order you want. Following our example, it should look something like this when you’re done sorting the posts:

Re-order WordPress blog posts using the Post Types Order plugin.

The advantage of using this method is to re-order WordPress blog posts is that the timestamp of each post remains unaltered. Best of all, the posts will appear on the front-end exactly how they do on the back-end.

Wrapping it up

Though WordPress doesn’t offer any post re-ordering functionality right out of the box, implementing your own solution is a cakewalk. We covered three of the easiest ways to re-order WordPress blog posts on the front-end in this post, and hopefully, you’re in a good position now to take things further yourself.

Let’s quickly recap the advantages of each approach:

  1. If you want to re-order only a few posts then changing their timestamps manually is the simplest way to go about it.
  2. Those of you who want to re-order the blog posts based on their title (permanently) instead of the date can add a custom code snippet to their active theme’s functions.php file.
  3. If you want to re-order blog posts without altering their timestamps then using the Post Types Order plugin is an ideal option.

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

Free guide

4 Essential Steps to Speed Up
Your WordPress Website

Follow the simple steps in our 4-part mini series
and reduce your loading times by 50-80%. 🚀

Free Access

7 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Dan
August 16, 2018 7:12 am

In my posts, I have 16 pages, each page contains 20 posts, how do i move a post from lets say page 2 to the first spot on page 1? It will only let me drag a post on the current page. Thanks!

Thiago Guedes
April 27, 2018 6:25 am

Option 2 doesn´t works to me.

Simon Cannon
June 11, 2018 6:28 pm
Reply to  Thiago Guedes

The code sample is incorrect. Change all “$query-” to “$query->” instead.

Janet Falk
March 16, 2018 1:25 pm

I have two different kinds of posts: newsletters and Case Studies. Some of the Case Studies are mixed in with the newsletters in their order of publication. How can I separate the two and keep the newsletters and Case Studies each in their respective order?

Mario Badilla
February 7, 2018 10:42 pm

what about pages?

Fun Paw Care
January 17, 2018 7:50 pm

Will option 1, changing the date manually also change the original URL? I have my blogs sorted by URL in the WordPress permalink structure and do not want to change the date in which it originally posted as that will break and 401 all backlinks. Thanks Russ

Editor
Colin Newcomer
January 24, 2018 3:14 am
Reply to  Fun Paw Care

If you use dates in your permalink structure then yes, option 1 will change the URL.

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!