wp_get_attachment_id3_keys

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

WordPress Version: 5.4

/**
 * Returns useful keys to use to lookup data from an attachment's stored metadata.
 *
 * @since 3.9.0
 *
 * @param WP_Post $attachment The current attachment, provided for context.
 * @param string  $context    Optional. The context. Accepts 'edit', 'display'. Default 'display'.
 * @return string[] Key/value pairs of field keys to labels.
 */
function wp_get_attachment_id3_keys($attachment, $context = 'display')
{
    $fields = array('artist' => __('Artist'), 'album' => __('Album'));
    if ('display' === $context) {
        $fields['genre'] = __('Genre');
        $fields['year'] = __('Year');
        $fields['length_formatted'] = _x('Length', 'video or audio');
    } elseif ('js' === $context) {
        $fields['bitrate'] = __('Bitrate');
        $fields['bitrate_mode'] = __('Bitrate Mode');
    }
    /**
     * Filters the editable list of keys to look up data from an attachment's metadata.
     *
     * @since 3.9.0
     *
     * @param array   $fields     Key/value pairs of field keys to labels.
     * @param WP_Post $attachment Attachment object.
     * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
     */
    return apply_filters('wp_get_attachment_id3_keys', $fields, $attachment, $context);
}

WordPress Version: 4.6

/**
 * Returns useful keys to use to lookup data from an attachment's stored metadata.
 *
 * @since 3.9.0
 *
 * @param WP_Post $attachment The current attachment, provided for context.
 * @param string  $context    Optional. The context. Accepts 'edit', 'display'. Default 'display'.
 * @return array Key/value pairs of field keys to labels.
 */
function wp_get_attachment_id3_keys($attachment, $context = 'display')
{
    $fields = array('artist' => __('Artist'), 'album' => __('Album'));
    if ('display' === $context) {
        $fields['genre'] = __('Genre');
        $fields['year'] = __('Year');
        $fields['length_formatted'] = _x('Length', 'video or audio');
    } elseif ('js' === $context) {
        $fields['bitrate'] = __('Bitrate');
        $fields['bitrate_mode'] = __('Bitrate Mode');
    }
    /**
     * Filters the editable list of keys to look up data from an attachment's metadata.
     *
     * @since 3.9.0
     *
     * @param array   $fields     Key/value pairs of field keys to labels.
     * @param WP_Post $attachment Attachment object.
     * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
     */
    return apply_filters('wp_get_attachment_id3_keys', $fields, $attachment, $context);
}

WordPress Version: 4.2

/**
 * Returns useful keys to use to lookup data from an attachment's stored metadata.
 *
 * @since 3.9.0
 *
 * @param WP_Post $attachment The current attachment, provided for context.
 * @param string  $context    Optional. The context. Accepts 'edit', 'display'. Default 'display'.
 * @return array Key/value pairs of field keys to labels.
 */
function wp_get_attachment_id3_keys($attachment, $context = 'display')
{
    $fields = array('artist' => __('Artist'), 'album' => __('Album'));
    if ('display' === $context) {
        $fields['genre'] = __('Genre');
        $fields['year'] = __('Year');
        $fields['length_formatted'] = _x('Length', 'video or audio');
    } elseif ('js' === $context) {
        $fields['bitrate'] = __('Bitrate');
        $fields['bitrate_mode'] = __('Bitrate Mode');
    }
    /**
     * Filter the editable list of keys to look up data from an attachment's metadata.
     *
     * @since 3.9.0
     *
     * @param array   $fields     Key/value pairs of field keys to labels.
     * @param WP_Post $attachment Attachment object.
     * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
     */
    return apply_filters('wp_get_attachment_id3_keys', $fields, $attachment, $context);
}

WordPress Version: 4.0

/**
 * Return useful keys to use to lookup data from an attachment's stored metadata.
 *
 * @since 3.9.0
 *
 * @param WP_Post $attachment The current attachment, provided for context.
 * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
 * @return array Key/value pairs of field keys to labels.
 */
function wp_get_attachment_id3_keys($attachment, $context = 'display')
{
    $fields = array('artist' => __('Artist'), 'album' => __('Album'));
    if ('display' === $context) {
        $fields['genre'] = __('Genre');
        $fields['year'] = __('Year');
        $fields['length_formatted'] = _x('Length', 'video or audio');
    } elseif ('js' === $context) {
        $fields['bitrate'] = __('Bitrate');
        $fields['bitrate_mode'] = __('Bitrate Mode');
    }
    /**
     * Filter the editable list of keys to look up data from an attachment's metadata.
     *
     * @since 3.9.0
     *
     * @param array   $fields     Key/value pairs of field keys to labels.
     * @param WP_Post $attachment Attachment object.
     * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
     */
    return apply_filters('wp_get_attachment_id3_keys', $fields, $attachment, $context);
}

WordPress Version: 3.9

/**
 * Return useful keys to use to lookup data from an attachment's stored metadata.
 *
 * @since 3.9.0
 *
 * @param WP_Post $attachment The current attachment, provided for context.
 * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
 * @return array Key/value pairs of field keys to labels.
 */
function wp_get_attachment_id3_keys($attachment, $context = 'display')
{
    $fields = array('artist' => __('Artist'), 'album' => __('Album'));
    if ('display' === $context) {
        $fields['genre'] = __('Genre');
        $fields['year'] = __('Year');
        $fields['length_formatted'] = _x('Length', 'video or audio');
    }
    /**
     * Filter the editable list of keys to look up data from an attachment's metadata.
     *
     * @since 3.9.0
     *
     * @param array   $fields     Key/value pairs of field keys to labels.
     * @param WP_Post $attachment Attachment object.
     * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
     */
    return apply_filters('wp_get_attachment_id3_keys', $fields, $attachment, $context);
}