您可以设置$_GET
直接在您的pre_get_posts
使UI拾取该更改的操作:
function wpd_test_pre_get( $query ) {
// put whatever conditions to target your cpt here
if( is_admin() && $query->is_main_query() ){
// modify query
$query->set(\'orderby\', \'title\');
$query->set(\'order\', \'asc\');
// set $_GET vars
$_GET[\'orderby\'] = \'title\';
$_GET[\'order\'] = \'asc\';
}
}
add_action( \'pre_get_posts\', \'wpd_test_pre_get\' );