WP Admin default view mode for Custom Post Type

To change the mode URL variable but in the load try this:

add_action( 'load-edit.php', 'my_default_posts_list_mode' );
function my_default_posts_list_mode() {

    $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : '';
    if ( $post_type && $post_type == 'my_post_type' && !isset( $_REQUEST['mode'] ) )
        $_REQUEST['mode'] = 'excerpt';
}

Got the “insipration” from here: Set Default Listing “View” in Admin

Leave a Comment

tech