[wp-hackers] WP Custom Post Type as 'Taxonomy' for Other Custom Post Type

Lox lox.dev at knc.nc
Thu Mar 24 08:13:54 UTC 2011


2011/3/24 Otto <otto at ottodestruct.com>

> It has nothing to do with how you register the post type. It has to do
> with how you create the posts.
>
> Attachment posts work in the same way. The attachment post has a
> post_type of "attachment" and the post_parent is set to the post where
> the attachment was uploaded (which has a post type of "post" or
> "page").
>
> When you do wp_insert_post to insert your custom post, you just set
> the post_parent to the ID of the parent post item. Post type is
> irrelevant to that.


That post_parent use rocks.

I personnaly use to use a custom metabox: when creating a new 'release' a
custom metabox field allows to choose an artist (using a select box or an
autocomplete text field) and I store the artist ID as a post meta.

-- 
Lox
lox.dev at knc.nc


More information about the wp-hackers mailing list