• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / get_the_post_thumbnail_caption() – Returns the post thumbnail caption.

You appear to be a bot. Output may be restricted

Description

Returns the post thumbnail caption.

Usage

$string = get_the_post_thumbnail_caption( $post );

Parameters

$post
( int|WP_Post ) optional – Optional. Post ID or WP_Post object. Default is global `$post`.

Returns

string Post thumbnail caption.

Source

File name: wordpress/wp-includes/post-thumbnail-template.php
Lines:

1 to 15 of 15
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;
}
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: get_the_post_thumbnail_caption
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-includes/post-thumbnail-template.php
File ref: wp-includes/post-thumbnail-template.php
Deprecated?: No
API Letters: C,G,P,T

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites