Admin multiple column sorting

Since WordPress already allows for the sorting of page titles alphabetically (either ascending or descending order), all that is actually needed is to add an Author filter.

This can be achieved by adding the following to the functions.php file of your active theme:

function rudr_filter_by_the_author() {
    $params = array(
        'name' => 'author', // this is the "name" attribute for filter <select>
        'show_option_all' => 'All authors' // label for all authors (display posts without filter)
    );

    if ( isset($_GET['user']) )
        $params['selected'] = $_GET['user']; // choose selected user by $_GET variable

    wp_dropdown_users( $params ); // print the ready author list
}

add_action('restrict_manage_posts', 'rudr_filter_by_the_author');

I found the above snippet at Misha Rudrastyh’s website and have tested it on my own WordPress admin area without a problem.

All it does is add an Author filter to the admin area posts and pages sections. You can then filter your posts/pages by author, and then sort them by title (or date) in ascending/descending order as preferred.

But keep in mind that having this in functions.php of your theme means this feature will only be available as long as that theme remains active. If that is a problem for you, just make this snippet into a plugin of your own to activate/deactivate when needed.

So to turn this into a plugin that will work with any theme, save the following into a file called admin-area-author-filter.php and then upload it to your WordPress plugin directory:

<?php

/*
Plugin Name: Admin Area Author Filter
Description: Adds an author filter to the posts and pages sections of the admin area. Snippet taken from: https://rudrastyh.com/wordpress/filter-posts-by-author.html
*/

function rudr_filter_by_the_author() {
    $params = array(
        'name' => 'author', // this is the "name" attribute for filter <select>
        'show_option_all' => 'All authors' // label for all authors (display posts without filter)
    );

    if ( isset($_GET['user']) )
        $params['selected'] = $_GET['user']; // choose selected user by $_GET variable

    wp_dropdown_users( $params ); // print the ready author list
}

add_action('restrict_manage_posts', 'rudr_filter_by_the_author');

?>

Then just activate it and you are good to go.

Thank you for asking this question, by the way. It made me curious and now I have a handy author filter in my admin area, too. I’m surprised this isn’t a core feature like the category filter in the posts area. It’s very useful, so thank you again for bringing this issue to my attention.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)