Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // function and action to order classes alphabetically ===========================
- function set_custom_post_types_admin_order($wp_query) {
- if( is_admin() ){
- // Get the post type from the query --------------------------------------
- $post_type = $wp_query->query['post_type'];
- if ( $post_type == 'YOUR_POST_TYPE_HERE') {
- // 'orderby' value can be any column name ------------------------
- $wp_query->set( 'orderby', 'title' );
- // 'order' value can be ASC or DESC ------------------------------
- $wp_query->set( 'order', 'ASC' );
- }
- }
- }
- add_filter('pre_get_posts', 'set_custom_post_types_admin_order');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement