让WordPress后台的文章列表按照更新编辑时间排序

在当前主题的functions.php中添加以下php代码即可:
function ludou_set_post_order_in_admin( $wp_query ) { if ( is_admin() ) { $wp_query->set( 'orderby', 'modified' ); // 此处是将最新修改的文章排在前面 // 如果要将最新修改的文章排在后面,可将DESC改成ASC $wp_query->set( 'order', 'DESC' ); } } add_filter('pre_get_posts', 'ludou_set_post_order_in_admin' );
