Change Default Order Of Post Or Page In WordPress Admin
As we all know, posts are showing in latest first order in post grid of wordpress admin and same with the pages also. We can filter them by using above filters as per our choice.
But in few situations we need to reverse the order permanently, so that there will be no any need to set the filters again and again. In these type of cases, just copy and paste the below mentioned code in your functions.php file of your current theme :
<?php function set_post_order_in_admin( $wp_query ) { global $pagenow; if ( is_admin() && 'edit.php' == $pagenow && !isset($_GET['orderby'])) { $wp_query->set( 'orderby', 'title' ); $wp_query->set( 'order', 'DESC' ); } } add_filter('pre_get_posts', 'set_post_order_in_admin' ); ?>
After applying the above code, your posts or pages will show in descending or reverse than the previous order in wordpress admin/backend grid section.
Leave a Reply