感谢anmari,我的php知识水平有点高,但从另一个角度来看,我还是设法解决了这个问题。通过更改“全局$子菜单”和代码进行排序:
/**
* Makes the "All" sorting and "publish" default on edit screen for custom post types
*/
function default_post_sorting(){
global $submenu;
// Administrator users don\'t need this, bail out
if( current_user_can(\'add_users\') )
return;
//\'publish\' default
$submenu[\'edit.php?post_type=my_post_type\'][5][2] = \'edit.php?post_status=publish&post_type=my_post_type\';
//\'All\' default
$submenu[\'edit.php?post_type=my_post_type\'][5][2] = \'edit.php?post_type=my_post_type&all_posts=1\';
}
add_action( \'admin_menu\', \'default_post_sorting\');
只需将“my\\u post\\u type”更改为您的posttype。