Filter hook 'view_mode_post_types'

in WP Core File wp-admin/includes/class-wp-screen.php at line 1317

View Source

view_mode_post_types

Filter Hook
Description
Filters the post types that have different view mode options.

Hook Information

File Location wp-admin/includes/class-wp-screen.php View on GitHub
Hook Type Filter
Line Number 1317

Hook Parameters

Type Name Description
string[] $view_mode_post_types Array of post types that can change view modes. Default post types with show_ui on.

Usage Examples

Basic Usage
<?php
// Hook into view_mode_post_types
add_filter('view_mode_post_types', 'my_custom_filter', 10, 1);

function my_custom_filter($view_mode_post_types) {
    // Your custom filtering logic here
    return $view_mode_post_types;
}

Source Code Context

wp-admin/includes/class-wp-screen.php:1317 - How this hook is used in WordPress core
<?php
1312  		 * @since 4.4.0
1313  		 *
1314  		 * @param string[] $view_mode_post_types Array of post types that can change view modes.
1315  		 *                                       Default post types with show_ui on.
1316  		 */
1317  		$view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
1318  
1319  		if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) {
1320  			return;
1321  		}
1322  

PHP Documentation

<?php
/**
		 * Filters the post types that have different view mode options.
		 *
		 * @since 4.4.0
		 *
		 * @param string[] $view_mode_post_types Array of post types that can change view modes.
		 *                                       Default post types with show_ui on.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/includes/class-wp-screen.php
Related Hooks

Related hooks will be displayed here in future updates.