Filter hook 'disable_formats_dropdown'

in WP Core File wp-admin/includes/class-wp-posts-list-table.php at line 513

View Source

disable_formats_dropdown

Filter Hook
Description
Filters whether to remove the 'Formats' drop-down from the post list table.

Hook Information

File Location wp-admin/includes/class-wp-posts-list-table.php View on GitHub
Hook Type Filter
Line Number 513

Hook Parameters

Type Name Description
bool $disable Whether to disable the drop-down. Default false.
string $post_type Post type slug.

Usage Examples

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

function my_custom_filter($disable, $post_type) {
    // Your custom filtering logic here
    return $disable;
}

Source Code Context

wp-admin/includes/class-wp-posts-list-table.php:513 - How this hook is used in WordPress core
<?php
 508  		 * @since 5.5.0 The `$post_type` parameter was added.
 509  		 *
 510  		 * @param bool   $disable   Whether to disable the drop-down. Default false.
 511  		 * @param string $post_type Post type slug.
 512  		 */
 513  		if ( apply_filters( 'disable_formats_dropdown', false, $post_type ) ) {
 514  			return;
 515  		}
 516  
 517  		// Return if the post type doesn't have post formats or if we're in the Trash.
 518  		if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) {

PHP Documentation

<?php
/**
		 * Filters whether to remove the 'Formats' drop-down from the post list table.
		 *
		 * @since 5.2.0
		 * @since 5.5.0 The `$post_type` parameter was added.
		 *
		 * @param bool   $disable   Whether to disable the drop-down. Default false.
		 * @param string $post_type Post type slug.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/class-wp-posts-list-table.php
Related Hooks

Related hooks will be displayed here in future updates.