display_media_states
Filter HookDescription
Filters the default media display states for items in the Media list table.Hook Information
File Location |
wp-admin/includes/template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2469 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$media_states
|
An array of media states. Default 'Header Image', 'Background Image', 'Site Icon', 'Logo'. |
WP_Post
|
$post
|
The current attachment object. |
Usage Examples
Basic Usage
<?php
// Hook into display_media_states
add_filter('display_media_states', 'my_custom_filter', 10, 2);
function my_custom_filter($media_states, $post) {
// Your custom filtering logic here
return $media_states;
}
Source Code Context
wp-admin/includes/template.php:2469
- How this hook is used in WordPress core
<?php
2464 *
2465 * @param string[] $media_states An array of media states. Default 'Header Image',
2466 * 'Background Image', 'Site Icon', 'Logo'.
2467 * @param WP_Post $post The current attachment object.
2468 */
2469 return apply_filters( 'display_media_states', $media_states, $post );
2470 }
2471
2472 /**
2473 * Tests support for compressing JavaScript from PHP.
2474 *
PHP Documentation
<?php
/**
* Filters the default media display states for items in the Media list table.
*
* @since 3.2.0
* @since 4.8.0 Added the `$post` parameter.
*
* @param string[] $media_states An array of media states. Default 'Header Image',
* 'Background Image', 'Site Icon', 'Logo'.
* @param WP_Post $post The current attachment object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-admin/includes/template.php
Related Hooks
Related hooks will be displayed here in future updates.