Skip Navigation

[Resolved] Change CPT slug?

This support ticket is created 7 years, 4 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 12 replies, has 3 voices.

Last updated by Christian Cox 7 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#534519

So, working with this Real Estate Reference Site (and thanks for these, they are certainly helpful to see how things work), I needed to change CPT 'house' to 'home'. When I did this, the output broke significantly. Changed it back to 'house', and found things were still broken, such as Agent relationship, Templates no longer linked, CRED forms no longer linked, etc. So just restored the backup.

Any way to do this successfully? Such as with a database find/replace? Best practice for doing this?

Also, if Toolset isn't capable of handling this type of change, should it be allowed? - or at least a warning? I figured since it was allowed, it must then be handled properly on the back end. Woops.

Thanks for any help.

#534674

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Arthur,

Thank you for contacting Toolset support.

You can use the following plugin to search and replace slug for CPT inside shortcodes. I have tested this plugin at my end (for example for CRED form) and it works goods and all related slugs are successfully replaced: https://wordpress.org/plugins/better-search-replace/

You can change the slug as it is allowed in WordPress as well as in our Types plugin, but the shortcodes added inside a form or page are treated as any other content so we can’t find the connection that if it is used inside some shortcodes or not. That’s why the shortcodes stop working until we replace them and we can’t check and show a warning for the same reason.

Thank you

#534889

Hello,

First, Yes thanks for testing that method, I will try it.

As to your second paragraph, it seems my issue was not just shortcodes, which I could understand - but rather a complete disconnect of Parent/Child relationships, as well as disconnect of Templates and CRED forms - which IMO should be a controllable factor. I'm not sure that the above plugin would resolve that issue, but i will give it a go and see...

#535477

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Arthur,

Yes, sure you can give it a try and I hope it will resove the issue.

Have a great day,
Thank you

#539099

Unfortunately, this does not appear to resolve the issue with Toolset relationships. Performing the slug search replace does work in other areas, but seemingly not with parent/child, linked cred forms, templates etc., and manually reapplying them still seems to leave issues. I've tried a few different ways.

It would be great if there was a way to do this without having to restructure everything, even with a basic setup like the default for the Real Estate Reference Site, there is quite a bit to address.

It's not abnormal to need to change a slug after the fact, especially when working from a template that is to be applied to multiple projects.

If someone could determine a workable method to change slug 'house' to 'home' in the *default* Real Estate Reference Site, keeping relationships intact, I would love to know what it is. Maybe I'm just missing or skipping a step somewhere.

Tx

#539269

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

To me this is more of WordPress limitation the way WP registered post types, shortcodes, parent/child relationship etc. Trying to fix this in our plugin may needs a hack to the WP itself which our developers may not be willing to do but if you would like I can forward it for further consideration, let me know.

I assume that you have already tried replacing manually the concerned slugs / content in the database as well. As per my last testing the shortcodes did get updated using the Better Search Replace plugin.

Thank you

#540324

Mmm, yes - I've gone the database route in conjunction with direct change within the plugin/update permalinks etc - and while it takes you further in the process, it still does not defeat for example the cred form/template/parent/child relationship issues.

Regarding general WordPress deficiencies in this regard, I have also looked into more generic solutions as well. For example, I came across the following:

https://wordpress.stackexchange.com/questions/247328/change-custom-post-type-slug

...which is more geared at output rewrite - obviously not a true core change... but while this worked with a WP-only example I had, it doesn't seem to have any effect at all on my Toolset generated CPTs.

I'm curious what you think of this approach, and why it might not be working with the Toolset CPTs?

Thanks much

#540514

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello,

The method given in the above link is ok, it's a kind of workaround. But the problem here is that when I changed slug in my test WP site >> then replace the shortcodes using Better Search Replace plugin >> my CRED forms and other things started to work as normal. Whereas this is not working in your site so there is some problem in your WP site or there is something blocking it. If I was able to see the bug after these steps and reproduce it, then we could debug it further.

I would recommend to work with some dedicated developer who can debug this issue in your site, since the given steps are not working on that particular site only, we have some recommended list of service providers here who can help in such cases for you:
https://toolset.com/consultant/

Thank you

#540549

Regarding the stackexchange solution - as I stated, it *doesn't* work with the Real Estate Reference Site - and so I was inquiring as to why this might be the case?

As for testing on your end, is that with the Real Estate Reference Site?

In my case, I am testing with nothing but a brand new stock WP installation, with only the Real Estate Reference Site from Toolset (and only things it specifically required) activated.

If not, then maybe a better test on your end would be to make the change within that reference site - for example, change slug 'house' to 'home'. And see if all relationships/cred forms/etc. work.

I am very interested to see your result on this, I would really like to figure this out. Thank you.

#540648

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

No, I am using a standard WP site without Real Estate Reference Site, technically it should not make any difference. Are you using the reference site as it is after importing or you have created your own post types, cred forms, content templates etc which are not working?

I can try to check this in a clean install with Real Estate site but please note that it is also possible that this problem only happening in a old site (where WP and plugins versions have been upgraded multiple times) and may not appear in a newly created site. I have seen things like this due to such issues or some problems occurring in database etc.

To further debug this issue, I need to request temporary access (WP-Admin and FTP Login info) to your site (preferably staging site where problem appears), I need to see where and how this breaks first. Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please add the Links to the following pages which contain the issue:
- A CRED Form Edit link:
- Frontpage link for the same:
- Mention one name of shortcode which is not working:

- A Content Template or View Edit link:
- Frontpage link for the same:
- Mention one name of shortcode which is not working:

Thank you

#540714

Hello,

I can do that - but might it be better to simply launch this in a Toolset 'Test Site' location? Basically we're just launching a stock Real Estate Reference Site, and then trying to change one of the slugs. I don't recall where those are set up - or if we can run for example the find-replace plugin on it?

Thanks

#541664

Hi, Noman is unavailable today so I thought I would try to assist. I assume you mean a discover-wp.com test site, right? If so, then the problem with that approach is that it's not possible to add plugins to these sites, or observe server logs effectively. I will re-set the private reply fields here for you.

#542028

Private reply fields are now enabled, sorry for the duplicate post.

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