Skip Navigation

[Resolved] Consequences of removing a custom field

This support ticket is created 2 years, 6 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 2.26 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/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by simonM-5 2 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2357677

Hi Toolset

I just wanted a quick bit of advice on what the consequences are of removing a custom field, if data has already been entered in to it.

Thinking in database terms, I want to perform the equivalent of deleting a column in a table. So I'm imagining this to be the same as deleting a custom field in a custom post type. If I just delete the custom field, do I have to do any "clean up" operations on the database with SQL or should I perhaps even do this before I remove the custom field?

Or is it safe just to delete the custom field, and Toolset will automatically remove all data from that field from all records in the database? What is the expected behaviour?

Thanks and regards
Simon

#2358595

Hi Simon,

Deleting a custom field from its field group (WP Admin -> Toolset -> Custom Fields) won't delete its existing records in the database.

To delete those records, you can first remove the custom field from its field group and then delete that abandoned field from the "Post Field Control" section.
( you'll see its button at the bottom of the custom fields groups management screen at WP Admin -> Toolset -> Custom Fields )

Example screenshot 1: hidden link
Example screenshot 2: hidden link

regards,
Waqar

#2358685

Hey Waqar

Thanks for the update. I was more asking about what happens to any data that was entered in that field. Does the data also get deleted from wp_post_metadata if that field is deleted?

In other words, once a field is deleted, does Toolset take care of the deleted data in all records where data was present for that field?

Thanks and regards
Simon

#2358801

Thanks for writing back and I apologize if my last message wasn't clear.

For better understanding, let's break down the process of deleting a custom field into two main steps:

1. Removing the custom field:

When you'll remove a custom field from its custom field group, it will be removed from the relevant post/page edit screen. However, this field's data (i.e. individual entries in the "wp_postmeta" table) in the database won't be deleted.

2. Deleting the custom field data:

When you'll delete that custom field from the "Post Field Control" section (as explained in my last reply), Toolset will remove that field's data (i.e. individual entries in the "wp_postmeta" table) from the database too.

I hope this makes it more clear.

#2358807

Hi Waqar

Thanks for the clarification. So the step you mention in step 2 would be the equivalent of deleting the column in a database then, so that there is no trace of any data left over.

Thanks and regards
Simon

#2358877

> So the step you mention in step 2 would be the equivalent of deleting the column in a database then, so that there is no trace of any data left over.

- Yes, that is absolutely correct.

#2358879

OK, great. Thanks again, Waqar!

My issue is resolved now. Thank you!