From 06035926979604a1efc074e5d36c0f3b4463d4e9 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 7 Feb 2009 02:58:21 +0000 Subject: [PATCH] Fix wp_get_attachment_link(), props noel, fixes #9036 git-svn-id: https://develop.svn.wordpress.org/trunk@10520 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post-template.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index f46fcac5f6..b3ef040c2c 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -930,11 +930,12 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false $link_text = attribute_escape($text); } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) { $link_text = wp_get_attachment_image($id, $size, $icon); - } else { - $link_text = $_post->post_title; } + + if( trim($link_text) == '' ) + $link_text = $_post->post_title; - return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon ); + return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text ); } /**