Changeset 37915 for trunk/src/wp-includes/post.php
- Timestamp:
- 06/29/2016 05:28:00 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r37890 r37915 4938 4938 4939 4939 /** 4940 * Retrieves the caption for an attachment. 4941 * 4942 * @since 4.6.0 4943 * 4944 * @param int $post_id Optional. Attachment ID. Default 0. 4945 * @return string|false False on failure. Attachment caption on success. 4946 */ 4947 function wp_get_attachment_caption( $post_id = 0 ) { 4948 $post_id = (int) $post_id; 4949 if ( ! $post = get_post( $post_id ) ) { 4950 return false; 4951 } 4952 4953 if ( 'attachment' !== $post->post_type ) { 4954 return false; 4955 } 4956 4957 $caption = $post->post_excerpt; 4958 4959 /** 4960 * Filters the attachment caption. 4961 * 4962 * @since 4.6.0 4963 * 4964 * @param string $caption Caption for the given attachment. 4965 * @param int $post_id Attachment ID. 4966 */ 4967 return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID ); 4968 } 4969 4970 /** 4940 4971 * Retrieve thumbnail for an attachment. 4941 4972 *
Note: See TracChangeset
for help on using the changeset viewer.