Make WordPress Core

Ticket #33277: 33277.diff

File 33277.diff, 1.2 KB (added by DrewAPicture, 9 years ago)

+ changelog entry

  • src/wp-includes/post-template.php

     
    15551555 * Retrieve an attachment page link using an image or icon, if possible.
    15561556 *
    15571557 * @since 2.5.0
     1558 * @since 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object.
    15581559 *
    15591560 * @param int|WP_Post  $id        Optional. Post ID or post object.
    15601561 * @param string       $size      Optional, default is 'thumbnail'. Size of image, either array or string.
     
    15651566 * @return string HTML content.
    15661567 */
    15671568function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
    1568         $id = intval( $id );
    15691569        $_post = get_post( $id );
    15701570
    15711571        if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
     
    15771577        if ( $text ) {
    15781578                $link_text = $text;
    15791579        } 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 );
    15811581        } else {
    15821582                $link_text = '';
    15831583        }