Ticket #37343: 37343.2.diff
File 37343.2.diff, 1.1 KB (added by , 9 years ago) |
---|
-
src/wp-includes/post-template.php
1445 1445 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { 1446 1446 $_post = get_post( $id ); 1447 1447 1448 if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )1448 if ( empty( $_post ) || ( 'attachment' !== $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) { 1449 1449 return __( 'Missing Attachment' ); 1450 } 1450 1451 1451 if ( $permalink ) 1452 if ( $permalink ) { 1452 1453 $url = get_attachment_link( $_post->ID ); 1454 } 1453 1455 1454 1456 if ( $text ) { 1455 1457 $link_text = $text; … … 1459 1461 $link_text = ''; 1460 1462 } 1461 1463 1462 if ( trim( $link_text ) == '' )1464 if ( '' === trim( $link_text ) ) { 1463 1465 $link_text = $_post->post_title; 1466 } 1464 1467 1468 if ( '' === trim( $link_text ) ) { 1469 $link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) ); 1470 } 1465 1471 /** 1466 1472 * Filters a retrieved attachment page link. 1467 1473 *