Skip to main content
WordPress made easy with the drag & drop Total WordPress Theme - now just $39!Learn More

How To Reorder Standard & Custom Post Type Posts In WordPress

May 30, 2018

Ever since I started developing WordPress 3+ themes and using custom post types for things such as portfolios, services, faqs, staff, sliders..etc, I’ve been getting a lot of questions from people asking me how they can rearrange the order of their published posts. Unfortunately it’s not very obvious how to do this in WordPress and there isn’t a very easy and manageable way.

In the following post I’ll show you how you can e-order your custom posts using two different methods: changing the post date of your custom post or using a super awesome free WordPress plugin called “Post Type Order”.

Method 1: Change Post Date

The first method of changing your posts order is by changing the published dates of your posts. Most the time themes will use the default order_by => date argument in their themes so custom posts will show up in the order in which they were published (but it’s not always the case). To alter the post date simply click “quick edit” on any post in the dashboard and alter the date using the fields then click “update“.

wordpres-post-date-edit

Method 2: Altering the “Menu Order” position

If the custom post type (registration and output) supports the “menu_order” function then you may also be able to change the order by altering this value. For example in our Total WordPress Theme we’ve enabled this for all built-in post types making it easier to control your post type order for the front-end.

menu-order-wordpress

Method 3: Using The Post Type Order Plugin

My favorite way of changing the order of your posts is by using the “Post Type Order Plugin”. This plugin will allow you to easily move your posts around in a drag-and-drop fashion.

Plugin Page

Method 4: Using the pre_get_posts Filter

If you want to re-order your items via code its also very easy and you’ll want to use the pre_get_posts action in WordPress to do so. Please click on the former link to learn all about it. If you rather learn from an example, please have a look below!

function wpex_order_category( $query ) {
	// exit out if it's the admin or it isn't the main query
	if ( is_admin() || ! $query->is_main_query() ) {
		return;
	}
	// order category archives by title in ascending order
	if ( is_category() ) {
		$query->set( 'order' , 'asc' );
		$query->set( 'orderby', 'title');
		return;
	}
}
add_action( 'pre_get_posts', 'wpex_order_category', 1 );
order-custom-post-type-posts-wordpress
Article by AJ Clarke WPExplorer Staff
Published on: March 7, 2012
Last updated on: May 30, 2018
Subscribe to the Newsletter

Get our latest news, tutorials, guides, tips & deals delivered to your inbox.

12 Comments

  1. Nelson says:

    Hi man, how do i insert fotos to the default image gallery???

  2. mafudim says:

    Hi! How to do the same with categories? Is it possible to rotate it in the theme Office Responsive Business Theme

  3. mafudim says:

    Found Plugin Category Order and Taxonomy Terms Order. I think this is the answer to my question

  4. Alex says:

    Thank you so much!!! I’ve been looking for a solution for that for ages, and you gave a quick and simple answer, AWESOME!

  5. Mayeenul Islam says:

    `Method 3: Using the pre_get_posts Filter` – can I integrate custom fields there?

  6. nik pol says:

    Just huge thanks!

    First method seems to be the only method which can be used by an ordinary people without any technical background and the simplest in case one need to order custom type posts 🙂

  7. Aggu says:

    Great snippet thanks! But what is the “exit out if it’s the admin or it isn’t the main query” there for?

  8. Aggukg says:

    On second thought, that really is self explanatory 😉 so feel free to disregard…using it on the Total theme now!

  9. BountifulHealth4You says:

    i can’t get the quick edit back. please is that cuz they updated? how do i get back to the quick edit? That’s how i used to do it but can’t get to it again!

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn how your comment data is processed by viewing our privacy policy here.