From fcfb406c7cbfe641989e899ff109b32c43dd16a4 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 7 Dec 2010 18:16:21 +0000 Subject: [PATCH] Apply wp_get_attachment_url to empty urls. Props filosofo. fixes #15494 git-svn-id: https://develop.svn.wordpress.org/trunk@16768 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 1282129caa..916fc97875 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3831,10 +3831,12 @@ function wp_get_attachment_url( $post_id = 0 ) { if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this. $url = get_the_guid( $post->ID ); - if ( 'attachment' != $post->post_type || empty($url) ) - return false; + $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID ); - return apply_filters( 'wp_get_attachment_url', $url, $post->ID ); + if ( 'attachment' != $post->post_type || empty( $url ) ) + return false; + + return $url; } /**