Created
June 3, 2015 14:31
-
-
Save jdhobbsuk/24ee1d21d043d98d3922 to your computer and use it in GitHub Desktop.
Set custom post type to be listed alphabetically in the admin
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
// Set Meetup to alphabetical order and no pagination (in admin) | |
// ------------------------------------------------------------- | |
function set_venue_admin_order($wp_query) { | |
if (is_admin()) { | |
$post_type = $wp_query->query['post_type']; | |
if ( $post_type == 'venue') { | |
$wp_query->set('orderby', 'title'); | |
$wp_query->set('order', 'ASC'); | |
} | |
} | |
} | |
add_filter('pre_get_posts', 'set_venue_admin_order'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment