0

In administration, in the "All Pages" section, each time I add a new page the table is refreshed order by page Title. I reorder the table clicking on "Date" column to keep working on the last updated pages, but every refresh the order change again to Title.

I cannot find any plugin or way for Wordpress to remember the last order selected. Is there any way to achive this?

TL;DR I want Wordpress to remember the order of "All Pages" in the administration.

1

There is no plugin for that. But you can achieve this by using filters. Add following code to you theme's functions.php file:

/**
 * Order Admin Page List by Date by Default
 */

add_filter('pre_get_posts', 'my_set_page_order_in_admin' );
function my_set_page_order_in_admin( $wp_query ) {
    global $pagenow;
    if ( is_admin() && $_GET['post_type'] == 'page' && 'edit.php' == $pagenow && !isset($_GET['orderby'])) {
        $wp_query->set( 'orderby', 'date' );
        $wp_query->set( 'order', 'desc' );
    }
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.