WordPress.org

Make WordPress Core

Ticket #37343: 37343-05.patch

File 37343-05.patch, 552 bytes (added by Jonnyauk, 3 years ago)

@henry.wright - nice - looks a-little neater as a fallback, I've submitted a new patch (37343-05.patch) which retains the original title, which should be used if available.

  • wp-includes/post-template.php

    diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
    index be15252..785ce8c 100644
    a b function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals 
    14621462        if ( trim( $link_text ) == '' )
    14631463                $link_text = $_post->post_title;
    14641464
     1465        if ( trim( $link_text ) == '' )
     1466                $parts = pathinfo( get_attached_file( $_post->ID ) );
     1467                $link_text = esc_html( $parts['filename'] );
     1468
    14651469        /**
    14661470         * Filters a retrieved attachment page link.
    14671471         *