Make the ‘all’ filter default instead of ‘mine’ in a custom post type

answer ^^

add_action( 'load-edit.php', function() 
{
global $typenow;

// Not our post type, bail out
if( 'community' !== $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?post_type=community&all_posts=1') );
    exit();
}   
});

Leave a Comment