WordPress at a glance

get_the_post_thumbnail_caption() WP 1.0

Returns the post thumbnail caption.

✈ 1 time = 0.001914s = very slow | 50000 times = 0.85s = very fast | PHP 7.0.8, WP 4.6

No Hooks.

Return

String. Post thumbnail caption.

Usage

get_the_post_thumbnail_caption( $post );
$post(int/WP_Post)
Post ID or WP_Post object.
Default: global $post

Code of get_the_post_thumbnail_caption: wp-includes/post-thumbnail-template.php VER 5.0.1

<?php
function get_the_post_thumbnail_caption( $post = null ) {
	$post_thumbnail_id = get_post_thumbnail_id( $post );
	if ( ! $post_thumbnail_id ) {
		return '';
	}

	$caption = wp_get_attachment_caption( $post_thumbnail_id );

	if ( ! $caption ) {
		$caption = '';
	}

	return $caption;
}

Related Functions

From tag: caption (of image)

More from tag: Thumbnail (images)

More from category: Thumbnails

No comments
    Hello, !     Log In . Register