Skip Navigation

[Résolu] Steps to Rename Custom Field – Best Practice

This support ticket is created Il y a 4 années et 5 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 réponses, has 2 voix.

Last updated by Beda Il y a 4 années et 5 mois.

Assisted by: Beda.

Auteur
Publications
#1396555

Tell us what you are trying to do?
1. I have a custom field made using Types plugin - called wpcf-attorney-fax-status, thousands of posts now have this custom field associated to it.
2. I would like to rename the field using Types plugin to wpcf-attorney-lopr-status (to make it a little generic).

What is the best practice and what steps do you recommend to ensure it rename is done correctly?
I understand I have to update all the references to the field in the Views/Templates/Post Forms etc. What else? How to best update the thousands of Posts that have wpcf-attorney-fax-status as a custom field attached?

Is there any documentation that you are following?
1. I saw some posts in the Forum but I think it would be good to see a best practice. Unless I missed it in documentation.

Thanks
Mukesh

#1396631

Just update the Field Name and Field Slug in Toolset > Custom Fields > Your_Field_Group > Your_Field.
That's enough; Toolset Types does then take care of everything else, meaning you do not have to re-save your posts.

Of course, as you correctly recognized that does not update the Content Templates or any other instance where you display that field with eventual ShortCodes, Blocks or else.
To have those working again, you would require a manual update of those Templates.
(Note, this also includes Toolset Forms or View Filters).

However, you could use a trick to avoid even that, by updating only the Name of the Field instead of the name and slug of the Field.
Doing so would then show the new Name in the backend where you insert it, or in Forms, or even Search Labels - but it would still use the old slug. Hence you wouldn't even need to update the templates - because ShortCodes use the slug of the Field.

I suggest (even if it's trivial) to make a backup of your site before you proceed, especially if you have thousands of posts.
It would be a lot of lost work if anything at all goes wrong, and you can save that work by performing a backup (which takes just a few minutes only).

Let me know the results!

#1397163

Hi Beda,
Yes it worked. So Types takes care of updated the postmeta tables after the slug of the Field is renamed! That is great!

Only issue I guess would be is, I performed the rename on my Dev site, then used Modules to Export the renamed field to the Prod site. The Modules doesn't do the same updates to the postmeta. So perhaps an update to the Modules functionality is needed, other no issues!!
Thanks,
Mukesh

#1398345

Have you tried to delete the existing modules and recreate them in the Module Manager?
Those are "finished" packages, so updating the fields or posts won't alter them, but if you delete and recreate those, it should then work, as it will create fresh modules from the now updated content structures.

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