Ticket #33277: 33277.diff
File 33277.diff, 1.2 KB (added by , 9 years ago) |
---|
-
src/wp-includes/post-template.php
1555 1555 * Retrieve an attachment page link using an image or icon, if possible. 1556 1556 * 1557 1557 * @since 2.5.0 1558 * @since 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object. 1558 1559 * 1559 1560 * @param int|WP_Post $id Optional. Post ID or post object. 1560 1561 * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. … … 1565 1566 * @return string HTML content. 1566 1567 */ 1567 1568 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { 1568 $id = intval( $id );1569 1569 $_post = get_post( $id ); 1570 1570 1571 1571 if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) … … 1577 1577 if ( $text ) { 1578 1578 $link_text = $text; 1579 1579 } elseif ( $size && 'none' != $size ) { 1580 $link_text = wp_get_attachment_image( $ id, $size, $icon, $attr );1580 $link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr ); 1581 1581 } else { 1582 1582 $link_text = ''; 1583 1583 }