Support » Plugin: Toolset Types - Custom Post Types, Custom Fields and Taxonomies » Custom fields are not removed from post_meta table on deletion

  • If you create a custom field group, add some custom fields there, then delete some fields from it, then add some other fields on their place, the old fields still persist in table post_meta (those are with prefix wpcf-).

    Example: I have custom field group “Group A”, with 2 custom numeric fields (“FLD1” and “FLD2”). I decide at some point that I do not need one of them and remove it from the group (the fields group was attached to custom post type). In the place of removed field I place another custom field of type date. As a person normally expect – the deleted field should be completely removed from post_meta table, but it is not.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Dear Budiony

    You have right. Types do not delete any data during uninstall process.

    If you want to remove all custom fields just use this SQL:

    delete from wp_postmeta where meta_key like 'wpcf-%';
    delete from wp_usermeta where meta_key like 'wpcf-%';



    It looks like you can delete that field using the “Custom Fields Control” on the Custom Fields listing page. Is that what you were asking?

    The issue I’m talking is not related tonthe uninstall process (although it would be great for every plugin to clean after itself when user removes it). Also it appears only that you can delete the custom field from the “Custom field control” section from interface. The field is visually removed, but the data remains in postmeta table and in options table (in form of serialized string with all fields). This is issue for me, because I use custom SQL query to get fields currently associated with given custom post type. I’m sure it is a easy-to-fix problem, but I didn’t have time to digg more into the source code of the pligin and fix it by myself.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom fields are not removed from post_meta table on deletion’ is closed to new replies.