Filter hook 'media_submitbox_misc_sections'

in WP Core File wp-admin/includes/media.php at line 3438

View Source

media_submitbox_misc_sections

Filter Hook
Description
Filters the audio and video metadata fields to be shown in the publish meta box. The key for each item in the array should correspond to an attachment metadata key, and the value should be the desired label.

Hook Information

File Location wp-admin/includes/media.php View on GitHub
Hook Type Filter
Line Number 3438

Hook Parameters

Type Name Description
array $fields An array of the attachment metadata keys and labels.
WP_Post $post WP_Post object for the current attachment.

Usage Examples

Basic Usage
<?php
// Hook into media_submitbox_misc_sections
add_filter('media_submitbox_misc_sections', 'my_custom_filter', 10, 2);

function my_custom_filter($fields, $post) {
    // Your custom filtering logic here
    return $fields;
}

Source Code Context

wp-admin/includes/media.php:3438 - How this hook is used in WordPress core
<?php
3433  		 * @since 4.9.0 Added the `$post` parameter.
3434  		 *
3435  		 * @param array   $fields An array of the attachment metadata keys and labels.
3436  		 * @param WP_Post $post   WP_Post object for the current attachment.
3437  		 */
3438  		$fields = apply_filters( 'media_submitbox_misc_sections', $fields, $post );
3439  
3440  		foreach ( $fields as $key => $label ) {
3441  			if ( empty( $meta[ $key ] ) ) {
3442  				continue;
3443  			}

PHP Documentation

<?php
/**
		 * Filters the audio and video metadata fields to be shown in the publish meta box.
		 *
		 * The key for each item in the array should correspond to an attachment
		 * 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 WP_Post $post   WP_Post object for the current attachment.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.