Customizing Category Display Order in WordPress Admin
By default, WordPress admin categories (including taxonomies and tags) are sorted by name. Sometimes you may want to display them by creation order (ID) or other criteria. While modifying core files is possible, directly editing WordPress core files is not recommended as updates will overwrite your changes. Using plugins or code snippets (functions.php) is the preferred approach.
Below are two historical methods for reference, followed by a safer alternative.
Method 1: Modify Core Files (Not Recommended, For Reference Only)
This involves editing WordPress core files directly and applies to specific older versions.
For WordPress 4.6+
- Edit Category Admin Page Sorting
Open:wp-admin/edit-tags.php
Find:$dropdown_args = array(
In the parameter array, change:'orderby' => 'name',
To:'orderby' => 'id', - Edit Post List & Edit Page Category Sorting
Open:wp-includes/class-wp-term-query.php(around line 175 in WP 4.6)
Find:$this->query_var_defaults = array(
In the parameter array, change:'orderby' => 'name',
To:'orderby' => 'id',
For WordPress 4.0 to 4.5
- Edit Category Admin Page Sorting
Open:wp-admin/edit-tags.php
Find:$dropdown_args = array(
In the parameter array, change:'orderby' => 'name',
To:'orderby' => 'id', - Edit Post List & Edit Page Category Sorting
Open:wp-includes/taxonomy.php(around line 1174 in WP 4.5)
Find function:function get_terms( $args = array(), $deprecated = '' ) {
In the default parameter array, change:'orderby' => 'name',
To:'orderby' => 'id',
After these changes, admin categories will display sorted by ID (creation time).
Method 2: Recommended Approach – Use Code Snippet (functions.php)
Add this code to your current theme's functions.php file to safely modify backend category sorting without affecting WordPress updates.
// Change default taxonomy order to ID in admin
function modify_backend_term_order( $args, $taxonomies ) {
// Apply only in admin area
if ( is_admin() ) {
$args['orderby'] = 'id';
$args['order'] = 'DESC'; // Optional: newest first
}
return $args;
}
add_filter( 'get_terms_args', 'modify_backend_term_order', 10, 2 );
This code uses the get_terms_args filter to change the sorting field to id in the admin area. You can adjust 'order' => 'DESC' to 'ASC' or change orderby to other fields like count (post count) or slug.
Summary
While modifying core files works quickly, it carries maintenance risks. For long-term sites, strongly recommend adding code to functions.php or using a dedicated plugin to customize admin category order, following WordPress best practices.