Make WordPress Core

Ticket #37343: 37343.diff

File 37343.diff, 585 bytes (added by henry.wright, 9 years ago)
  • src/wp-includes/post-template.php

    diff --git src/wp-includes/post-template.php src/wp-includes/post-template.php
    index be15252..a894c6b 100644
    function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals 
    14591459                $link_text = '';
    14601460        }
    14611461
    1462         if ( trim( $link_text ) == '' )
    1463                 $link_text = $_post->post_title;
     1462        if ( trim( $link_text ) == '' ) {
     1463                $parts = pathinfo( get_attached_file( $_post->ID ) );
     1464                $link_text = esc_html( $parts['filename'] );
     1465        }
    14641466
    14651467        /**
    14661468         * Filters a retrieved attachment page link.