0

I have a custom plugin I created that adds some custom meta input fields to every post

I want to remove all this plugin generated rows of postmeta for each post when I uninstall/delete the plugin

what code should I add to the plugin php file to do this?

1 Answer 1

0

Take a look at the documentation for register_uninstall_hook. There is as well a register_deactivation_hook function which can be usefull as well.

You could use them for calling a function which will remove the data from DB. But you should be careful and maybe let user check a checkbox to do so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.