[wp-hackers] Re: permalinks redirected despite WP_SITEURL

Otto otto at ottodestruct.com
Mon Aug 25 20:38:55 GMT 2008


function wp_get_attachment_url( $post_id = 0 ) {
	$post_id = (int) $post_id;
	if ( !$post =& get_post( $post_id ) )
		return false;

	$url = get_the_guid( $post->ID );

	if ( 'attachment' != $post->post_type || !$url )
		return false;

	return apply_filters( 'wp_get_attachment_url', $url, $post->ID );

Can anybody tell me why WordPress doing this stupid, stupid thing? The
GUID is NOT the right place to store the URL!

On Mon, Aug 25, 2008 at 3:36 PM, Otto <otto at ottodestruct.com> wrote:
> Well, the most obvious answer would be that it didn't, and you are mistaken. :)
> However, I'd say that depending on how exactly you changed those
> records, you may have also changed the real places where the links to
> your attached images live. Namely, the img tags in the post content
> and in the postmeta table (for the attachments and links to the images
> from there).
> On Mon, Aug 25, 2008 at 3:26 PM, Daniel Torreblanca
> <regulatethis at gmail.com> wrote:
>> So why did changing this to my new URL suddenly make the images work?
>> If it's just being used as a UUID, I wouldn't think that would be the
>> case.
>> On Mon, Aug 25, 2008 at 3:48 PM, Otto <otto at ottodestruct.com> wrote:
>>> The GUID field should not be used as a URL anywhere in the whole of
>>> WordPress. The fact that it is a URL is only coincidental.

More information about the wp-hackers mailing list