Skip Navigation

[Resolved] Rename of Custom Post Type slug removes all posts & post fields.

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

Problem: I would like to give a custom post type a different slug.

Solution: You can rename a post type slug and translate it in WPML String Translation. Then you may need to edit any Views of this post type and re-select the Post type in the content selection area.

This support ticket is created 6 years, 10 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 10 replies, has 2 voices.

Last updated by Christian Cox 6 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#625963

I am trying to:
Rename a slug of a custom post type, I accidently wrote the slug with a typo,
And I noticed it just now (after creating post fields and posts).

After I renamed it to remove the typo,
All data was gone, all posts and post fields.

Once I've renamed it back to the slug with the typo, all the data was restored.

But I'm still interested in fixing the typo, so how can I do that?

Thanks.

#625998

Hi, you should be able to rename the custom post type slug without losing data. My guess is that there is a setting in WPML that is causing problems here. Did you translate the new slug into all languages? As a test, can you temporarily deactivate WPML plugins and try again?

#626165

I indeed use WPML, as the CPT is being translated.
In order to keep it working, what is the needed change I'm required to do in WPML translate?

Unfortunately I cannot deactivate the WPML plugin :/

#626261

Usually you can translate the slug in String Translation, assuming you have enabled Custom Post Slug translation in WPML settings. You can find more information about translating custom post type slugs in the WPML documentation:
https://wpml.org/documentation/getting-started-guide/translating-page-slugs/

#626396
Screen Shot 2018-03-20 at 11.07.49.png

I attached a screenshot,
As you can see it's not translated.

I'm trying to understand what am I doing wrong...
It should be translated? I never translated it as I found no use for that, I wanted to keep the 'laurate' slug same in English for all the translated languages.

Just to make sure, when I change the Slug in Toolset Types,
It makes all the posts to disappear, also in the original language, so I'm not sure how it's related to WPML.

Would be glad to have your assistance.

#626680

It should be translated? I never translated it as I found no use for that, I wanted to keep the 'laurate' slug same in English for all the translated languages.
Yes, if you want to use the same "laurate" slug in all languages, you should click "translations" here and add "laurate" in all languages.

#628033

Ok, and once I do that, I will be able to change the slug without all the data to disappear?

#628082

Ok, and once I do that, I will be able to change the slug without all the data to disappear?
As I said before, you should be able to rename the slug without losing data. If that is not the case, then there must be something else going on. If I could log into your wp-admin area and create a clone of your site, I can take a closer look. If that's okay with you, please provide login credentials in the private reply fields here.

#630580

Okay I updated the slug to be "laureate" instead of "laurate" in Toolset > Post Types. Then I saved the site Permalinks in Settings > Permalinks. Next I went to the (English) Laureates list in wp-admin: hidden link. From here, I updated the Hebrew translation of all Laureate posts to be sure the new slug was applied correctly in both languages.
Here are two of those items:
hidden link
hidden link

It appears the data was preserved, including the Laurate Fields, the Content Template assignment, the featured image, Awards, Countries, Alphabets, and Competitions. Can you check and confirm?

#647098

The posts have disappeared from here:
hidden link

This is a view based on the custom post type.

Maybe I need to do something on the view to "refresh" it?
Can you please check?

#648782

Edit the View and re-select the post type at the top of the editor, then resave the View.