Support » Fixing WordPress » Sort pages by date in admin by default

  • What do I need to change to make the page listing in the admin sort by date by default instead of title.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey dtmp, did you get a solution for this?

    Ultimately I was able to do this by adding the following to functions.php

    /*———————————————————————————–*/
    /* Order Admin Pages by Date by Default
    /*———————————————————————————–*/

    function set_post_order_in_admin( $wp_query ) {
    global $pagenow;
      if ( is_admin() && 'edit.php' == $pagenow && !isset($_GET['orderby'])) {
        $wp_query->set( 'orderby', 'date' );
        $wp_query->set( 'order', 'DSC' );
      }
    }
    add_filter('pre_get_posts', 'set_post_order_in_admin' );

    Pariahdecss solution worked for me. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort pages by date in admin by default’ is closed to new replies.