0

I try to figure out as the title mentions and I found this:

How To Disable (or Remove) "All Posts, Published, and Trash" in Dashboard Posts

And birgire's answer is spot on, but I need the "All" link to be default instead of the "Mine" and I just can't figure it out.

I also on another posttype want to default to "published"

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.