WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/23/2017 05:06:40 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Pass $post parameter to post_submitbox_start, attachment_submitbox_misc_actions, media_submitbox_misc_sections, audio_submitbox_misc_sections filters.

Props sebastian.pisula, SergeyBiryukov.
Fixes #36206.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r41328 r41581  
    29002900
    29012901    if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
     2902        $fields = array(
     2903            'length_formatted' => __( 'Length:' ),
     2904            'bitrate'          => __( 'Bitrate:' ),
     2905        );
    29022906
    29032907        /**
     
    29082912         *
    29092913         * @since 3.7.0
     2914         * @since 4.9.0 Added the `$post` parameter.
    29102915         *
    2911          * @param array $fields An array of the attachment metadata keys and labels.
     2916         * @param array   $fields An array of the attachment metadata keys and labels.
     2917         * @param WP_Post $post   WP_Post object for the current attachment.
    29122918         */
    2913         $fields = apply_filters( 'media_submitbox_misc_sections', array(
    2914             'length_formatted' => __( 'Length:' ),
    2915             'bitrate'          => __( 'Bitrate:' ),
    2916         ) );
     2919        $fields = apply_filters( 'media_submitbox_misc_sections', $fields, $post );
    29172920
    29182921        foreach ( $fields as $key => $label ) {
     
    29392942        }
    29402943
     2944        $fields = array(
     2945            'dataformat' => __( 'Audio Format:' ),
     2946            'codec'      => __( 'Audio Codec:' )
     2947        );
     2948
    29412949        /**
    29422950         * Filters the audio attachment metadata fields to be shown in the publish meta box.
     
    29462954         *
    29472955         * @since 3.7.0
     2956         * @since 4.9.0 Added the `$post` parameter.
    29482957         *
    2949          * @param array $fields An array of the attachment metadata keys and labels.
     2958         * @param array   $fields An array of the attachment metadata keys and labels.
     2959         * @param WP_Post $post   WP_Post object for the current attachment.
    29502960         */
    2951         $audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(
    2952             'dataformat' => __( 'Audio Format:' ),
    2953             'codec'      => __( 'Audio Codec:' )
    2954         ) );
     2961        $audio_fields = apply_filters( 'audio_submitbox_misc_sections', $fields, $post );
    29552962
    29562963        foreach ( $audio_fields as $key => $label ) {
Note: See TracChangeset for help on using the changeset viewer.