Summery Summery

Filters input from media_upload_form_handler() and assigns a default post_title from the file name if none supplied.

Syntax Syntax

image_attachment_fields_to_save( array $post, array $attachment )

Description Description

Illustrates the use of the ‘attachment_fields_to_save’ filter which can be used to add default values to any field before saving to DB.

Parameters Parameters


(Required) The WP_Post attachment object converted to an array.


(Required) An array of attachment metadata.

Return Return

(array) Filtered attachment post object.

Source Source

File: wp-admin/includes/media.php

 * Output a textarea element for inputting an attachment caption.
 * @since 3.4.0
 * @param WP_Post $edit_post Attachment WP_Post object.
 * @return string HTML markup for the textarea element.
function wp_caption_input_textarea( $edit_post ) {
	// Post data is already escaped.
	$name = "attachments[{$edit_post->ID}][post_excerpt]";


Changelog Changelog

Version Description
2.5.0 Introduced.


Leave a Reply