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

Leo germani leogermani at gmail.com
Fri Nov 12 14:36:40 UTC 2010


Ok. This is how it worked so far.

But I think we can think of a new way to llok at it. We have now the
possibility to create new post types, we could have new 'attachment post
types'. For instance: 'portfolio image' and 'clipping'.

This could be an option in register_post_type().

Dont you think it would be usefull?

On Fri, Nov 12, 2010 at 11:58 AM, Otto <otto at ottodestruct.com> wrote:

> A "post" should never have an attached file like that. Attachments get
> their own post for them, with the post_type of "attachment" and other
> metadata about the attachment stored in the post_meta. They're
> connected to the original post via the post_parent.
>
> Similarly, I can't think of a good reason for a custom post type to
> have an attached file. It should have attachment posts hooked to it
> instead. Without the attachment posts, there's no place to store the
> specific meta information about the file.
>
> -Otto
>
>
>
> On Fri, Nov 12, 2010 at 7:31 AM, Leo germani <leogermani at gmail.com> wrote:
> > 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
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



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


More information about the wp-hackers mailing list