[wp-hackers] taxonomy and post types relationships

Andrew Nacin wp at andrewnacin.com
Thu Mar 3 12:20:50 UTC 2011


On Thu, Mar 3, 2011 at 6:51 AM, Steve Taylor <steve at sltaylor.co.uk> wrote:

> I'm curious, what's the difference between associating a post type
> with a taxonomy and associating a taxonomy with a post type?
>
> That is, what's the difference between using the $object_type
> parameter of register_taxonomy(), and using the $taxonomies argument
> of register_post_type() ?
>

Normal usage: there's no difference; they're just aliases.

That said, through register_taxonomy(), "object type" does not need to be a
post type. While you could actually use a taxonomy on (for example) users,
the more common situation is attachment taxonomies, which allows a
particular syntax to also support mime types, such as 'attachment:image'.

Object type can also be arbitrary for
register_taxonomy_for_object_type($taxonomy, $object_type). This function is
actually used internally in register_post_type(), but in that case the
object type being passed is actually the post type.

Nacin


More information about the wp-hackers mailing list