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. git-svn-id: https://develop.svn.wordpress.org/trunk@41581 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9fc9372d57
commit
81551b9e36
@ -2899,6 +2899,10 @@ function attachment_submitbox_metadata() {
|
||||
endif;
|
||||
|
||||
if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
|
||||
$fields = array(
|
||||
'length_formatted' => __( 'Length:' ),
|
||||
'bitrate' => __( 'Bitrate:' ),
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the audio and video metadata fields to be shown in the publish meta box.
|
||||
@ -2907,13 +2911,12 @@ function attachment_submitbox_metadata() {
|
||||
* metadata key, and the value should be the desired label.
|
||||
*
|
||||
* @since 3.7.0
|
||||
* @since 4.9.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param array $fields An array of the attachment metadata keys and labels.
|
||||
* @param array $fields An array of the attachment metadata keys and labels.
|
||||
* @param WP_Post $post WP_Post object for the current attachment.
|
||||
*/
|
||||
$fields = apply_filters( 'media_submitbox_misc_sections', array(
|
||||
'length_formatted' => __( 'Length:' ),
|
||||
'bitrate' => __( 'Bitrate:' ),
|
||||
) );
|
||||
$fields = apply_filters( 'media_submitbox_misc_sections', $fields, $post );
|
||||
|
||||
foreach ( $fields as $key => $label ) {
|
||||
if ( empty( $meta[ $key ] ) ) {
|
||||
@ -2938,6 +2941,11 @@ function attachment_submitbox_metadata() {
|
||||
<?php
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'dataformat' => __( 'Audio Format:' ),
|
||||
'codec' => __( 'Audio Codec:' )
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the audio attachment metadata fields to be shown in the publish meta box.
|
||||
*
|
||||
@ -2945,13 +2953,12 @@ function attachment_submitbox_metadata() {
|
||||
* metadata key, and the value should be the desired label.
|
||||
*
|
||||
* @since 3.7.0
|
||||
* @since 4.9.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param array $fields An array of the attachment metadata keys and labels.
|
||||
* @param array $fields An array of the attachment metadata keys and labels.
|
||||
* @param WP_Post $post WP_Post object for the current attachment.
|
||||
*/
|
||||
$audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(
|
||||
'dataformat' => __( 'Audio Format:' ),
|
||||
'codec' => __( 'Audio Codec:' )
|
||||
) );
|
||||
$audio_fields = apply_filters( 'audio_submitbox_misc_sections', $fields, $post );
|
||||
|
||||
foreach ( $audio_fields as $key => $label ) {
|
||||
if ( empty( $meta['audio'][ $key ] ) ) {
|
||||
|
@ -244,8 +244,12 @@ do_action( 'post_submitbox_misc_actions', $post );
|
||||
* Fires at the beginning of the publishing actions section of the Publish meta box.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @since 4.9.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param WP_Post|null $post WP_Post object for the current post on Edit Post screen,
|
||||
* null on Edit Link screen.
|
||||
*/
|
||||
do_action( 'post_submitbox_start' );
|
||||
do_action( 'post_submitbox_start', $post );
|
||||
?>
|
||||
<div id="delete-action">
|
||||
<?php
|
||||
@ -326,8 +330,11 @@ function attachment_submit_meta_box( $post ) {
|
||||
* in the attachment editing screen.
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @since 4.9.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param WP_Post $post WP_Post object for the current attachment.
|
||||
*/
|
||||
do_action( 'attachment_submitbox_misc_actions' );
|
||||
do_action( 'attachment_submitbox_misc_actions', $post );
|
||||
?>
|
||||
</div><!-- #misc-publishing-actions -->
|
||||
<div class="clear"></div>
|
||||
@ -914,7 +921,7 @@ function link_submit_meta_box($link) {
|
||||
<div id="major-publishing-actions">
|
||||
<?php
|
||||
/** This action is documented in wp-admin/includes/meta-boxes.php */
|
||||
do_action( 'post_submitbox_start' );
|
||||
do_action( 'post_submitbox_start', null );
|
||||
?>
|
||||
<div id="delete-action">
|
||||
<?php
|
||||
|
Loading…
Reference in New Issue
Block a user