Thank’s anmari,
A tad over my level of php knowledge, but manage to sort it out looking at it in another way. Sorted with changing the “global $submenu” and the code:
/**
* 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');
Just change “my_post_type” to your posttype.