wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_get_attachment_caption › WordPress Function
Since4.6.0
已弃用n/a
› wp_get_attachment_caption ( $post_id = 0 )
参数: |
|
返回: |
|
定义在: |
|
文档: |
Retrieves the caption for an attachment.
Related Functions: wp_get_attachment_link, get_attachment_icon, wp_get_attachment_image, wp_get_attachment_url, get_attachment_link
源码
function wp_get_attachment_caption( $post_id = 0 ) { $post_id = (int) $post_id; $post = get_post( $post_id ); if ( ! $post ) { return false; } if ( 'attachment' !== $post->post_type ) { return false; } $caption = $post->post_excerpt; /** * Filters the attachment caption. * * @since 4.6.0 * * @param string $caption Caption for the given attachment. * @param int $post_id Attachment ID. */ return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID ); }