Don’t Delete Custom Fields on Quick Edit Save

When saving custom fields from a custom metabox, if the value is empty, usually the custom field is deleted. This is good, as it keeps from having lots of empty entries in the database.

However, it means that when you update from the “Quick Edit” menu, since your custom fields are not in the form, they will disappear. Not so good.

Here’s the fix.  Add this to your save function for the metabox:

 So, your save function should look something like this:

 

Comments are closed.