1

I am building a cancellations system for schools by area. Basically each Area is a Custom Post Type. There are 13 in total. Under the 13 CPT are 6 registered_taxonomies that are the same reasons for a cancellation, but depending on the Area(CPT) the school names under registered_taxonomies are different.

I have been researching and trying different approaches for hours however, All of the registered_taxonomies mirror eachother. If I add or delete a term in one it is added or deleted in the others because the taxonomies all share the same name. Is it possible to separate them without having to register 91 taxonomiesm, each with different names. It seems like it should be possible but I can't find a solution. Any help is greatly appreciated. I have simplified my code with only two CPT's for ease of clarity.

I have tried adding a variable before the taxonomy name to capture the CPT name so it wouldn't duplicate but that didn't work. Im at a loss

//Tried but didn't work, just comes up as empty variable.
//global $post
//$cpt = get_post_type($post->ID);

    register_taxonomy(
        //$cpt.'reason',
        'reason',
        array('hp_mitchell_area','hp_stratford_area'),
        array(
            'hierarchical' => true,
            'label' => 'Reason for Cancellation/Delay',
            'query_var' => true,
            'rewrite' => array(
                //'slug' => $cpt->slug, //The Parent Slug that displays before taxonomy
                'with_front' => true //Do not display the category base
            )
        )
    );
0

You can't do that. Each taxonomy can be assigned to one or more post types, but, they share all terms.

2
  • Thanks for your comment Milan .If it is not possible then I will have to try another approach. Perhaps hiding specific terms somehow from individual users/user groups.
    – bilcker
    Aug 28 '17 at 20:00
  • Only with custom coding, because WP lacks such control over terms. Aug 28 '17 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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