To change it globally to excerpt
for every post type I can use:
function my_default_posts_list_mode( $default ) {
return 'excerpt';
}
add_filter( 'default-posts-list-mode', 'my_default_posts_list_mode' );
But how can I achieve the same only for a Custom Post Type?
Explanation:
I've created a Custom Post Type. In WP Admin the default view mode is set to list (edit.php?post_type=my_post_type&mode=list). I want it to be excerpt
, but only for my Custom Post Type not affecting other post types.
I can do this manually by adding &mode=excerpt
to the URL like so: edit.php?post_type=my_post_type&mode=excerpt
, however I want this to be done automatically.