_media_states

The timeline below displays how wordpress function _media_states has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Outputs the attachment media states as HTML.
 *
 * @since 3.2.0
 * @since 5.6.0 Added the `$display` parameter and a return value.
 *
 * @param WP_Post $post    The attachment post to retrieve states for.
 * @param bool    $display Optional. Whether to display the post states as an HTML string.
 *                         Default true.
 * @return string Media states string.
 */
function _media_states($post, $display = true)
{
    $media_states = get_media_states($post);
    $media_states_string = '';
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        $media_states_string .= ' — ';
        foreach ($media_states as $state) {
            ++$i;
            $separator = ($i < $state_count) ? ', ' : '';
            $media_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
        }
    }
    if ($display) {
        echo $media_states_string;
    }
    return $media_states_string;
}

WordPress Version: 5.9

/**
 * Outputs the attachment media states as HTML.
 *
 * @since 3.2.0
 * @since 5.6.0 Added the `$echo` parameter and a return value.
 *
 * @param WP_Post $post The attachment post to retrieve states for.
 * @param bool    $echo Optional. Whether to echo the post states as an HTML string. Default true.
 * @return string Media states string.
 */
function _media_states($post, $echo = true)
{
    $media_states = get_media_states($post);
    $media_states_string = '';
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        $media_states_string .= ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            $sep = ($i < $state_count) ? ', ' : '';
            $media_states_string .= "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
    if ($echo) {
        echo $media_states_string;
    }
    return $media_states_string;
}

WordPress Version: 5.6

/**
 * Outputs the attachment media states as HTML.
 *
 * @since 3.2.0
 * @since 5.6.0 Added the `$echo` parameter and a return value.
 *
 * @param WP_Post $post The attachment post to retrieve states for.
 * @param bool    $echo Optional. Whether to echo the post states as an HTML string. Default true.
 * @return string Media states string.
 */
function _media_states($post, $echo = true)
{
    $media_states = get_media_states($post);
    $media_states_string = '';
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        $media_states_string .= ' &mdash; ';
        foreach ($media_states as $state) {
            $sep = (++$i === $state_count) ? '' : ', ';
            $media_states_string .= "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
    if ($echo) {
        echo $media_states_string;
    }
    return $media_states_string;
}

WordPress Version: 5.5

/**
 * Outputs the attachment media states as HTML.
 *
 * @since 3.2.0
 *
 * @param WP_Post $post The attachment post to retrieve states for.
 */
function _media_states($post)
{
    static $header_images;
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (is_random_header_image()) {
            if (!isset($header_images)) {
                $header_images = wp_list_pluck(get_uploaded_header_images(), 'attachment_id');
            }
            if ($meta_header === $stylesheet && in_array($post->ID, $header_images, true)) {
                $media_states[] = __('Header Image');
            }
        } else {
            $header_image = get_header_image();
            // Display "Header Image" if the image was ever used as a header image.
            if (!empty($meta_header) && $meta_header === $stylesheet && wp_get_attachment_url($post->ID) !== $header_image) {
                $media_states[] = __('Header Image');
            }
            // Display "Current Header Image" if the image is currently the header image.
            if ($header_image && wp_get_attachment_url($post->ID) === $header_image) {
                $media_states[] = __('Current Header Image');
            }
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background === $stylesheet) {
            $media_states[] = __('Background Image');
            $background_image = get_background_image();
            if ($background_image && wp_get_attachment_url($post->ID) === $background_image) {
                $media_states[] = __('Current Background Image');
            }
        }
    }
    if ((int) get_option('site_icon') === $post->ID) {
        $media_states[] = __('Site Icon');
    }
    if ((int) get_theme_mod('custom_logo') === $post->ID) {
        $media_states[] = __('Logo');
    }
    /**
     * 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.
     */
    $media_states = apply_filters('display_media_states', $media_states, $post);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            $sep = (++$i === $state_count) ? '' : ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 5.4

/**
 * Function to echo the attachment media states as HTML.
 *
 * @since 3.2.0
 *
 * @param WP_Post $post The attachment post to retrieve states for.
 * @return string Media states string.
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (is_random_header_image()) {
            $header_images = wp_list_pluck(get_uploaded_header_images(), 'attachment_id');
            if ($meta_header == $stylesheet && in_array($post->ID, $header_images)) {
                $media_states[] = __('Header Image');
            }
        } else {
            $header_image = get_header_image();
            // Display "Header Image" if the image was ever used as a header image.
            if (!empty($meta_header) && $meta_header === $stylesheet && wp_get_attachment_url($post->ID) !== $header_image) {
                $media_states[] = __('Header Image');
            }
            // Display "Current Header Image" if the image is currently the header image.
            if ($header_image && wp_get_attachment_url($post->ID) === $header_image) {
                $media_states[] = __('Current Header Image');
            }
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background === $stylesheet) {
            $media_states[] = __('Background Image');
            $background_image = get_background_image();
            if ($background_image && wp_get_attachment_url($post->ID) === $background_image) {
                $media_states[] = __('Current Background Image');
            }
        }
    }
    if (get_option('site_icon') == $post->ID) {
        $media_states[] = __('Site Icon');
    }
    if (get_theme_mod('custom_logo') == $post->ID) {
        $media_states[] = __('Logo');
    }
    /**
     * 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.
     */
    $media_states = apply_filters('display_media_states', $media_states, $post);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 5.3

/**
 * Function to echo the attachment media states as HTML.
 *
 * @since 3.2.0
 *
 * @param WP_Post $post The attachment post to retrieve states for.
 * @return string Media states string.
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (is_random_header_image()) {
            $header_images = wp_list_pluck(get_uploaded_header_images(), 'attachment_id');
            if ($meta_header == $stylesheet && in_array($post->ID, $header_images)) {
                $media_states[] = __('Header Image');
            }
        } else {
            $header_image = get_header_image();
            // Display "Header Image" if the image was ever used as a header image
            if (!empty($meta_header) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Header Image');
            }
            // Display "Current Header Image" if the image is currently the header image
            if ($header_image && $header_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Header Image');
            }
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
            $background_image = get_background_image();
            if ($background_image && $background_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Background Image');
            }
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    if ($post->ID == get_theme_mod('custom_logo')) {
        $media_states[] = __('Logo');
    }
    /**
     * 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.
     */
    $media_states = apply_filters('display_media_states', $media_states, $post);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 5.1

/**
 * @param WP_Post $post
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (is_random_header_image()) {
            $header_images = wp_list_pluck(get_uploaded_header_images(), 'attachment_id');
            if ($meta_header == $stylesheet && in_array($post->ID, $header_images)) {
                $media_states[] = __('Header Image');
            }
        } else {
            $header_image = get_header_image();
            // Display "Header Image" if the image was ever used as a header image
            if (!empty($meta_header) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Header Image');
            }
            // Display "Current Header Image" if the image is currently the header image
            if ($header_image && $header_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Header Image');
            }
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
            $background_image = get_background_image();
            if ($background_image && $background_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Background Image');
            }
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    if ($post->ID == get_theme_mod('custom_logo')) {
        $media_states[] = __('Logo');
    }
    /**
     * 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.
     */
    $media_states = apply_filters('display_media_states', $media_states, $post);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 4.8

/**
 *
 * @param WP_Post $post
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (is_random_header_image()) {
            $header_images = wp_list_pluck(get_uploaded_header_images(), 'attachment_id');
            if ($meta_header == $stylesheet && in_array($post->ID, $header_images)) {
                $media_states[] = __('Header Image');
            }
        } else {
            $header_image = get_header_image();
            // Display "Header Image" if the image was ever used as a header image
            if (!empty($meta_header) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Header Image');
            }
            // Display "Current Header Image" if the image is currently the header image
            if ($header_image && $header_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Header Image');
            }
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
            $background_image = get_background_image();
            if ($background_image && $background_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Background Image');
            }
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    if ($post->ID == get_theme_mod('custom_logo')) {
        $media_states[] = __('Logo');
    }
    /**
     * 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 ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 4.7

/**
 *
 * @param WP_Post $post
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (is_random_header_image()) {
            $header_images = wp_list_pluck(get_uploaded_header_images(), 'attachment_id');
            if ($meta_header == $stylesheet && in_array($post->ID, $header_images)) {
                $media_states[] = __('Header Image');
            }
        } else {
            $header_image = get_header_image();
            // Display "Header Image" if the image was ever used as a header image
            if (!empty($meta_header) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Header Image');
            }
            // Display "Current Header Image" if the image is currently the header image
            if ($header_image && $header_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Header Image');
            }
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
            $background_image = get_background_image();
            if ($background_image && $background_image == wp_get_attachment_url($post->ID)) {
                $media_states[] = __('Current Background Image');
            }
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    if ($post->ID == get_theme_mod('site_logo')) {
        $media_states[] = __('Logo');
    }
    /**
     * Filters the default media display states for items in the Media list table.
     *
     * @since 3.2.0
     *
     * @param array $media_states An array of media states. Default 'Header Image',
     *                            'Background Image', 'Site Icon', 'Logo'.
     */
    $media_states = apply_filters('display_media_states', $media_states);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 4.6

/**
 *
 * @param WP_Post $post
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (!empty($meta_header) && $meta_header == $stylesheet) {
            $media_states[] = __('Header Image');
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    if ($post->ID == get_theme_mod('site_logo')) {
        $media_states[] = __('Logo');
    }
    /**
     * Filters the default media display states for items in the Media list table.
     *
     * @since 3.2.0
     *
     * @param array $media_states An array of media states. Default 'Header Image',
     *                            'Background Image', 'Site Icon', 'Logo'.
     */
    $media_states = apply_filters('display_media_states', $media_states);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 4.5

/**
 *
 * @param WP_Post $post
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (!empty($meta_header) && $meta_header == $stylesheet) {
            $media_states[] = __('Header Image');
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    if ($post->ID == get_theme_mod('site_logo')) {
        $media_states[] = __('Logo');
    }
    /**
     * Filter the default media display states for items in the Media list table.
     *
     * @since 3.2.0
     *
     * @param array $media_states An array of media states. Default 'Header Image',
     *                            'Background Image', 'Site Icon', 'Logo'.
     */
    $media_states = apply_filters('display_media_states', $media_states);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 4.4

/**
 *
 * @param WP_Post $post
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (!empty($meta_header) && $meta_header == $stylesheet) {
            $media_states[] = __('Header Image');
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    /**
     * Filter the default media display states for items in the Media list table.
     *
     * @since 3.2.0
     *
     * @param array $media_states An array of media states. Default 'Header Image',
     *                            'Background Image', 'Site Icon'.
     */
    $media_states = apply_filters('display_media_states', $media_states);
    if (!empty($media_states)) {
        $state_count = count($media_states);
        $i = 0;
        echo ' &mdash; ';
        foreach ($media_states as $state) {
            ++$i;
            ($i == $state_count) ? $sep = '' : $sep = ', ';
            echo "<span class='post-state'>{$state}{$sep}</span>";
        }
    }
}

WordPress Version: 4.3

/**
 *
 * @param WP_Post $post
 */
function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (!empty($meta_header) && $meta_header == $stylesheet) {
            $media_states[] = __('Header Image');
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
        }
    }
    if ($post->ID == get_option('site_icon')) {
        $media_states[] = __('Site Icon');
    }
    /**
     * Filter the default media display states for items in the Media list table.
     *
     * @since 3.2.0
     *
     * @param array $media_states An array of media states. Default 'Header Image',
     *                            'Background Image', 'Site Icon'.
     */
    $media_states = apply_filters('display_media_states', $media_states);
    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>";
        }
    }
}

WordPress Version: 3.9

function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (!empty($meta_header) && $meta_header == $stylesheet) {
            $media_states[] = __('Header Image');
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
        }
    }
    /**
     * Filter the default media display states for items in the Media list table.
     *
     * @since 3.2.0
     *
     * @param array $media_states An array of media states. Default 'Header Image',
     *                            'Background Image'.
     */
    $media_states = apply_filters('display_media_states', $media_states);
    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>";
        }
    }
}

WordPress Version: 3.7

function _media_states($post)
{
    $media_states = array();
    $stylesheet = get_option('stylesheet');
    if (current_theme_supports('custom-header')) {
        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
        if (!empty($meta_header) && $meta_header == $stylesheet) {
            $media_states[] = __('Header Image');
        }
    }
    if (current_theme_supports('custom-background')) {
        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
        if (!empty($meta_background) && $meta_background == $stylesheet) {
            $media_states[] = __('Background Image');
        }
    }
    $media_states = apply_filters('display_media_states', $media_states);
    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>";
        }
    }
}