display_media_states filter-hookWP 3.2.0

Filters the default media display states for items in the Media list table.

Usage

add_filter( 'display_media_states', 'wp_kama_display_media_states_filter', 10, 2 );

/**
 * Function for `display_media_states` filter-hook.
 * 
 * @param string[] $media_states An array of media states.
 * @param WP_Post  $post         The current attachment object.
 *
 * @return string[]
 */
function wp_kama_display_media_states_filter( $media_states, $post ){

	// filter...
	return $media_states;
}
$media_states(string[])
An array of media states.
Default: 'Header Image', 'Background Image', 'Site Icon', 'Logo'
$post(WP_Post)
The current attachment object.

Changelog

Since 3.2.0 Introduced.
Since 4.8.0 Added the $post parameter.

Where the hook is called

get_media_states()
display_media_states
wp-admin/includes/template.php 2368
return apply_filters( 'display_media_states', $media_states, $post );

Where the hook is used in WordPress

wp-includes/widgets/class-wp-widget-media.php 122
add_filter( 'display_media_states', array( $this, 'display_media_state' ), 10, 2 );