Skip Navigation

[Resolved] Consequences of removing a custom field

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
- 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 1 year, 11 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

Waqar
Supporter

Languages: English (English )

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

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

Waqar
Supporter

Languages: English (English )

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

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

Waqar
Supporter

Languages: English (English )

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

> 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!

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