0

I intend to set up the following:

  • CPT: job, team-member

They share

  • taxonomy: location

When I register location, I do this:

$args = array(
   ....
   'hierarchical'  => false,
   'rewrite'       => array( 'slug' => 'location' ),
);
register_taxonomy( 'location', array( 'team-member', 'job' ), $args );

My question: Do I need the 'taxonomies' line below

register_post_type('job', array(
   ....
   'rewrite'     => array('slug' => 'careers'),
   'taxonomies'  => array('location'),
));

Explanation is appreciated. Thanks.

0

1 Answer 1

1

You don't need both, one of them is enough. However you need to do it in a order when thing you are adding support to is already registers.

So in first case you need to define CPT before taxonomy and in second case after.

The third way would be to use register_taxonomy_for_object_type() which let's you do this after both are registered, regardless of order.

Not the answer you're looking for? Browse other questions tagged or ask your own question.