Last active
August 29, 2015 13:56
-
-
Save aliciaduffy/8791099 to your computer and use it in GitHub Desktop.
Default Sort WordPress Post Types Admin by Date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function duffy_custom_post_types_admin_order($wp_query) { | |
if ( is_admin && ( get_query_var('orderby') == 'menu_order title' ) ) { | |
// 'orderby' value can be any column name | |
$wp_query->set('orderby', 'date'); | |
// 'order' value can be ASC or DESC | |
$wp_query->set('order', 'DESC'); | |
} | |
} | |
add_filter('pre_get_posts', 'duffy_custom_post_types_admin_order'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment