Skip Navigation

[Résolu] How can Toolset take control of previously created custom taxonomies?

This support ticket is created Il y a 4 années et 3 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Auteur
Publications
#1487459

A while back, I used the plugin "WCK - Custom Fields and Custom Post Types Creator" to create two custom taxonomies that I have been attaching to posts. Now that my needs are a little more complex, I am using Toolset. Is there a way to get Toolset to "take over" those taxonomies? Most importantly, I would like to apply them to a new custom post type created by Toolset, and to include them in my Toolset Content Templates. Anything I should be aware of going in to this?

Thanks! -Seth

#1488011

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you mean that you are going to remove the plugin "WCK - Custom Fields and Custom Post Types Creator" and you still want to use the post types and taxonomies created using that plugin. If this is true:
==>
You should check the following doc and try to follow the guidelines if that helps you:
- https://toolset.com/documentation/user-guides/custom-content/convert-existing-custom-types-and-fields-to-types-control/#converting-custom-post-types-and-taxonomy

If above doe not help, you should try to use the following hook to add taxonomy to your desired post type created using Types :

add_filter( 'wpcf_type', 'toolset_support_add_taxonomy_to_cpt', 10, 2 );
function toolset_support_add_taxonomy_to_cpt( $params, $post_type ) {
    // adjust to your needs
    $cpt_slug   = array('cutom-post-type-slug' );
    $taxonomies_to_add = array( 'tribe_events_cat' );
    // stop editing
     
    if( !in_array($post_type,$cpt_slug) ) {
        return $params;
    }
 
    $params['taxonomies'] = isset( $params['taxonomies'] ) ? $params['taxonomies'] : array();
 
    if( is_array( $taxonomies_to_add ) ) {
        $params['taxonomies'] = array_merge( $params['taxonomies'], $taxonomies_to_add );
    } else {
        $params['taxonomies'][] = $taxonomies_to_add;
    }
 
    return $params;
}

Where:
- Replace 'cutom-post-type-slug' with your custom post type slug and tribe_events_cat with your taxonomy slug.

#1489031

I followed the guidelines at the link, didn't even need the extra code. Thanks so much!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.