wphooks.info - display_media_states

display_media_states

The hook occurs in the following file:

wp-admin/includes/template.php:
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
	/**
	 * 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 array   $media_states An array of media states. Default 'Header Image',
	 *                              'Background Image', 'Site Icon', 'Logo'.
	 * @param WP_Post $post         The current attachment object.
	 */
	$media_states = apply_filters( 'display_media_states', $media_states, $post );

	if ( ! empty( $media_states ) ) {
		$state_count = count( $media_states );
		$i = 0;
		echo ' — ';
		foreach ( $media_states as $state ) {
			++$i;
			( $i == $state_count ) ? $sep = '' : $sep = ', ';
			echo "<span class='post-state'>$state$sep</span>";