wp_caption_input_textarea() WordPress Function

The wp_caption_input_textarea() function allows you to add a caption to an image in a WordPress post. This function is typically used when you want to add a caption to an image that you have uploaded to your WordPress site.

wp_caption_input_textarea( WP_Post $edit_post ) #

Outputs a textarea element for inputting an attachment caption.


Parameters

$edit_post

(WP_Post)(Required)Attachment WP_Post object.


Top ↑

Return

(string) HTML markup for the textarea element.


Top ↑

Source

File: wp-admin/includes/media.php

function wp_caption_input_textarea( $edit_post ) {
	// Post data is already escaped.
	$name = "attachments[{$edit_post->ID}][post_excerpt]";

	return '<textarea name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>';
}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More