uninstall.php for my plugin to delete all the traces my plugin did to a site on uninstall (delete). I did it in a good way, but even after the deletion there are some fields in the
in these options there are multiple values from other plugins too.
How can I take care of such traces, how can I remove all those traces too?
I checked WooCommerce and found they leave no traces after there deletion, if the “delete data” checkbox is checked.
How can I do so?
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
I don’t think that you should touch these options. WordPress core already handles this, whether by removing the references to your plugin when it is deleted (as in
delete_plugins()), or by being coded in such a way that it can ignore the reference to the removed plugin. Actually, none of these three options will last very long, since they are all regenerated regularly. The one is a transient, which naturally expires anyway. The plugins are removed from the recently activated list after a week. And the plugin is removed from the
uninstall_plugins option by
Also, WooCommerce doesn’t touch these. It probably just looked like it removed itself because it was never added to these values in the first place, or was removed that quickly by WordPress. (It wouldn’t have been added to
uninstall_plugins at all, because it uses an
uninstall.php file instead of a function).
So, TL;DR: You don’t need to worry about this, WordPress will take care of it.