WordPress.org

Make WordPress Core

Changeset 41581


Ignore:
Timestamp:
09/23/2017 05:06:40 PM (2 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.

Location:
trunk/src/wp-admin/includes
Files:
2 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 ) {
  • trunk/src/wp-admin/includes/meta-boxes.php

    r41563 r41581  
    245245 *
    246246 * @since 2.7.0
    247  */
    248 do_action( 'post_submitbox_start' );
     247 * @since 4.9.0 Added the `$post` parameter.
     248 *
     249 * @param WP_Post|null $post WP_Post object for the current post on Edit Post screen,
     250 *                           null on Edit Link screen.
     251 */
     252do_action( 'post_submitbox_start', $post );
    249253?>
    250254<div id="delete-action">
     
    327331     *
    328332     * @since 3.5.0
     333     * @since 4.9.0 Added the `$post` parameter.
     334     *
     335     * @param WP_Post $post WP_Post object for the current attachment.
    329336     */
    330     do_action( 'attachment_submitbox_misc_actions' );
     337    do_action( 'attachment_submitbox_misc_actions', $post );
    331338    ?>
    332339</div><!-- #misc-publishing-actions -->
     
    915922<?php
    916923/** This action is documented in wp-admin/includes/meta-boxes.php */
    917 do_action( 'post_submitbox_start' );
     924do_action( 'post_submitbox_start', null );
    918925?>
    919926<div id="delete-action">
Note: See TracChangeset for help on using the changeset viewer.