Skip Navigation

[Resolved] CPT slug renaming breaks connection to templates, custom fields, VIEWS!

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

Problem:

I've renamed a few CPTs slugs, for example Campaign (campaign) had to become Campaña (campana). It turned out that Toolset treats the slugs as the unique identifier and changing them practically breaks a lot of things.

Solution:

Toolset Types plugin is using WP function register_post_type() to create new post types, and treats the post type slugs as the unique identifier of each post type,

And the Repeatable Field Groups is based on one-to-many relationship, so each "Repeatable Field Groups" is also a custom post type, which is also use the post type slugs as the unique identifier.

In your case, it is not recommended to change the post type slug, but you can change the other post type settings, for example:

- Name plural

- Name singular

Relevant Documentation:

https://developer.wordpress.org/reference/functions/register_post_type/

This support ticket is created 3 years, 2 months ago. 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.

Our next available supporter will start replying to tickets in about 0.42 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by beingk 3 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#2180671
Screenshot 2021-09-26 234823.png
Screenshot 2021-09-26 234642.png

Hello. I've built out an entire site with Toolset CPTs in a Multisite environment and have successfully cloned a few sites. However, since some of the cloned sites are in languages other than English and the slugs affect the URLs and other content display on the front end, I've renamed a few CPTs, for example Campaign (campaign) had to become Campaña (campana). It turned out that Toolset treats the slugs as the unique identifier and changing them practically breaks a lot of things. For starters, the Templates and assigned custom fields become orphaned and had to be reconnected. It was not a huge deal, but added some frustration and time to an already tight deadline.

However, the bigger issue is that my views broke as well, ,specifically Repeatable Field Groups no longer show up as an option in the existing views or brand new views. Those RFGs are already assigned to the (renamed) CPT.

I just checked a few of the cloned sites in English and there's no issue. A few other sites I cloned and changed the language to Spanish and Portuguese both are showing the same issue. Thank you for your help!

#2180789

Hello,

Yes, you are right, Toolset Types plugin is using WP function register_post_type() to create new post types, and treats the post type slugs as the unique identifier of each post type, see WP document:
https://developer.wordpress.org/reference/functions/register_post_type/
$post_type
(string) (Required) Post type key

And the Repeatable Field Groups is based on one-to-many relationship, so each "Repeatable Field Groups" is also a custom post type, which is also use the post type slugs as the unique identifier.

In your case, it is not recommended to change the post type slug, but you can change the post type settings, for example:
- Name plural
- Name singular

#2180831

Thanks for clarifying this. Since I have already changed slugs for multiple CPTs, is there a way to access the RFGs and reset the relationships? There is nothing showing up under Relationships and I have already assigned the field groups containing the RFGs to the proper (renamed) CPTs. Under 'Post Field Control' I can see the individual fields assigned to the Field Group, but not to the actual RFGs.

What's also funny is that while the existing views aren't showing the RFGs, they are acting as if they have already been selected. Which works fine for existing views, but I can't really select the RFGs for new views, and sooner or later I will need.

#2181299

Hi. I would like to follow up on this, as I already have sites live with the disconnected RFGs. If it's not possible to recreate the relationship with the renamed CPTs (although the relationship is still working for existing views, it's just not being listed under Content selection), what are my options?

I just created a test RFG for a CPT, added a few entries and attempted to create a View using the newly created RFGs, but those are nor showing up either. So I guess recreating the orphaned RFGs won't be of much help?

Thank you

#2181385

In my opinion, you can clone the website again, then change other post type settings, for example:
- Name plural
- Name singular

If you still need assistance for it, please provide a test site with the same problem, fill below private message box with login details, also point out the problem page URLs and view URL, I need a live website to test and debug.

#2183159

My issue is resolved now. Thank you!