[wp-hackers] How to create relations between custom post types?
Mike Schinkel
mikeschinkel at newclarity.net
Sat May 29 16:42:08 UTC 2010
On May 29, 2010, at 2:49 AM, Edward de Leau wrote:
> would it be possible to support cases where a custom post type and a
> custom taxonomy type carry
> the same name? I think they do not conflict.
>
> (It enables creating relations between custom post types).
Yes, I'm working on a project that will do exactly that. I believe that will become a common design pattern now that we have custom post types.
You will need, however, need to disable rewrite when you register your taxonomy by setting it to *false* like so:
register_taxonomy('mysterybox', 'building', array(
'hierarchical' => true,
'label' => __('Mystery Boxes'),
'singular_label' => __('Mystery Box'),
'rewrite' => false,
)
);
You will also need to develop your single-mysterybox.php such that it loads and displays your content from your applicable mysterybox and its related buildings. You comfortable with handling that part now that you understand how to resolve the URL routing issue, right?
-Mike
More information about the wp-hackers
mailing list