In administration, in the "All Pages" section, each time I add a new page the table is refreshed order by page Title. I reorder the table clicking on "Date" column to keep working on the last updated pages, but every refresh the order change again to Title.
I cannot find any plugin or way for Wordpress to remember the last order selected. Is there any way to achive this?
TL;DR I want Wordpress to remember the order of "All Pages" in the administration.
In administration, in the "All Pages" section, each time I add a new page the table is refreshed order by page Title. I reorder the table clicking on "Date" column to keep working on the last updated pages, but every refresh the order change again to Title.
I cannot find any plugin or way for Wordpress to remember the last order selected. Is there any way to achive this?
TL;DR I want Wordpress to remember the order of "All Pages" in the administration.
Share Improve this question asked Jun 1, 2020 at 21:47 Alex AngelicoAlex Angelico 1033 bronze badges 1- Check my answer bellow. – Sabbir Hasan Commented Jun 6, 2020 at 15:23
1 Answer
Reset to default 1There is no plugin for that. But you can achieve this by using filters. Add following code to you theme's functions.php
file:
/**
* Order Admin Page List by Date by Default
*/
add_filter('pre_get_posts', 'my_set_page_order_in_admin' );
function my_set_page_order_in_admin( $wp_query ) {
global $pagenow;
if ( is_admin() && $_GET['post_type'] == 'page' && 'edit.php' == $pagenow && !isset($_GET['orderby'])) {
$wp_query->set( 'orderby', 'date' );
$wp_query->set( 'order', 'desc' );
}
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742370457a4431162.html
评论列表(0条)