Currently the excerpt view is limited to non-hierarchical post types.
We are able to filter the view mode in the Screen Options:
with the view_mode_post_types
filter, introduced within ticket #22222 in changeset #35357:
/**
* Filters the post types that have different view mode options.
*
* @since 4.4.0
*
* @param array $view_mode_post_types Array of post types that can change view modes.
* Default hierarchical post types with show_ui on.
*/
$view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
but because of this check in WP_Posts_List_Table::column_title()
:
if (
! is_post_type_hierarchical( $this->screen->post_type )
&& 'excerpt' === $mode
&& current_user_can( 'read_post', $post->ID )
) {
echo esc_html( get_the_excerpt() );
}
we’re not able to modify this check directly to add support for hierarchical post types.
There are some hackish workarounds possible but I didn’t explore it further, as the ones I have in mind, might not be stable here.
ps: I think there’s a typo in the inline documentation:
Default hierarchical post types with show_ui on.
should be
Default non-hierarchical post types with show_ui on.
because the default ones are src:
$view_mode_post_types = get_post_types(
array( 'hierarchical' => false, 'show_ui' => true )
);
Update: The documentation for the filter has been fixed by ticket #41730