WordPress GuidePost → Sort Posts

How to sort WordPress posts within a category

WordPress shows posts by newest first—but what if you want to feature your most important content first, or display posts in a specific order by category? Whether you’re managing a product catalog, tutorial series, or event listing, sorting posts within a category helps improve navigation and keeps your content organized.

Let’s explore the best ways to do this using both plugins and code, with detailed step-by-step guidance.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

1. Use drag-and-drop plugins for manual control

Plugins are the easiest way to control post order without touching code. Most offer drag-and-drop sorting or category-specific options.

Simple Custom Post Order

The Simple Custom Post Order plugin adds drag-and-drop support directly inside your Posts list.

How to use it:

To sort within a category only:

This method is great when you want full manual control but don’t need sorting by custom fields or date logic.

Post Types Order (by Nsp Code)

Post Types Order offers more flexibility, especially for custom post types and taxonomies.

How to use it:

This plugin also supports advanced queries, custom post types, and multisite setups. If you ever expand beyond simple blog posts, it’s worth keeping installed.

2. Sort posts within a category using code

If you’re comfortable editing PHP and want to apply dynamic logic—like sorting by a custom field or alphabetically—this method gives you full control.

Add custom sorting with pre_get_posts

The pre_get_posts hook lets you modify how WordPress queries posts on category pages.

Example: Sort posts by a custom field called “priority”

To use this code:

Important notes:

3. Use custom WP_Query in template files (advanced)

If you’re building or modifying a theme, you can manually control how posts are queried in category.php.

Example: Sort posts alphabetically by title

This gives you granular control but should only be used if you’re familiar with child themes and template file editing.

Choosing the best method for your site

Which strategy will be most helpful for you depends on your specific needs and your technical know-how.

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.