Removed Mine filter and want to make All be default on Post page

I’ve made a function to hide the Mine filter in the screen wp-admin/edit.php, using unset:

Read More

But when I click in the Posts menu (wp-admin/edit.php), it will not go to All by default, it still goes to Mine filter.

How to make the default to be All?

Related posts

Leave a Reply

1 comment

  1. We can intercept what page we arrived at the very beginning of the load process (with load-(page)) and check if redirection is needed. See comments for logic.

    add_action( 'load-edit.php', function() 
    {
        global $typenow;
    
        // Not our post type, bail out
        if( 'post' !== $typenow )
            return;
    
        // Administrator users don't need this, bail out
        if( current_user_can('add_users') )
            return;
    
        // Only the Mine tab fills this conditions, redirect
        if( !isset( $_GET['post_status'] ) && !isset( $_GET['all_posts'] ) )
        {
            wp_redirect( admin_url('edit.php?all_posts=1') );
            exit();
        }   
    });