Skip Navigation

[Resolved] Control other Post Types with Toolset

This thread is resolved. Here is a description of the problem and solution.

Problem: Can we control other Software's Post Types with Toolset, so we could, for example, change the Post Types settings, such as add hierarchical true, or maybe remove archive true?

Solution: The only way to control other's Post Types with Toolset is to actually replace those with Toolset. https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

That may be a solution in cases where the other software later can be removed - as otherwise the Post Type would be registered twice. It is no solution when the other Software strongly relies on this Post Type and its settings. How strongly that software relies on such settings of Post Types depends on the software, it's best asked to the support offered by 3rd parties.

You can always easily set any post type into a relationship, as there, the post type does not need to be created by Toolset, to work. Also, you can display such data with Views easily, as long the post type is not fully hidden to the public.

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.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by marcusC-4 2 years, 3 months ago.

Assigned support staff: Beda.

Author
Posts
#1274777

I am using LearnDash on a site and I’d like to have hierarchy support for one of their post types (Lessons). I want to be able to say this lesson is a child of another lesson. Just like you can do with pages.

Is it possible to add that?

#1274871

You cannot edit non-Toolset Post Types with Toolset Types (unless native Posts and Pages, and those are only limitedly).

The only way to control other's Post Types with Toolset is to actually replace those with Toolset.
https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

That is likely not what you want to do with the LearnDash Post type, as that Plugin will have reasons to register a certain post type the exact way they do.

However, setting a post type into a relationship wouldn't be the issue - for this, you could just add a Relationship in Toolset > Relationships between that and any other post type.

This is not the native WordPress Hierarchical Relationship but it is similar as you could create a One To Many relations, allowing one parent only, for many posts child posts.
The relationship cannot be within the same post type though, as Pages hierarchy could.

The best here would be:
1. Consult with the Developers of that Post Type (LearnDash) if it is OK adding hierarchy support to the type. They will know if this potentially could ruin their workflow or functionality.
2. If there is no issue with that you could use WordPress's API to filter the Post Types Args: register_post_type_args().
This filters the arguments with which a Post Type is registered, so you can alter them and return them back to the Post Type register method, adding hierarchy support.
See more information here https://developer.wordpress.org/reference/hooks/register_post_type_args/
An example can be found here https://stackoverflow.com/questions/10750931/wordpress-how-to-add-hierarchy-to-posts

Let me know if this doesn't help or I misunderstood the goal.

#1274929

Beda, thank you for the reply. Great info here. I’ll reach out to LearnDash support and also consider a new CPT to create these relationships.

#1274931

My issue is resolved now. Thank you!