[wp-hackers] wp_get_attachment_url() checking for attachment post_type, really necessary?

Leo germani leogermani at gmail.com
Fri Nov 12 13:31:03 UTC 2010


Hi all,

in the wp_get_attachment_url() we have the following check

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

I was wondering if we really need this check for attachment post_type. If
the post have a "_wp_attached_file" postmeta record, isnt it enough?

Now with custom post types I think we are going to have other post types
that could behave as attachments. I do this with some "audio" post type,
which are uploaded audio files by the user. But I cant use
wp_get_attachment_url() because it will allways return false...

What do you think?

Leo,,



-- 
leogermani.pirex.com.br
leogermani.estudiolivre.org


More information about the wp-hackers mailing list