hlashbrooke / WordPress-Plugin-Template

A robust code template for creating a standards-compliant WordPress plugin.
https://hughlashbrooke.com/
GNU General Public License v2.0
1.03k stars 329 forks source link

Update uninstall.php #73

Closed alekseyn1 closed 4 years ago

alekseyn1 commented 5 years ago

Proposed uninstall.php

jonathanbossenger commented 5 years ago

Fixes #72 @hlashbrooke if you have a moment, please pop a thumbs up or thumbs down if you agree with this update, and I'll review with a view to merge.

hlashbrooke commented 5 years ago

It looks alright, but what I would much rather see is the names all of the options that the plugin sets stored in an object (do we not do that already?), then we can loop through that array/object and call delete_option() for each one. I know that's more queries in the end, but I always prefer using the available WP API's instead of raw SQL queries where possible - I think that's a better practice to be taught in a plugin template like this.

jonathanbossenger commented 5 years ago

@alekseyn1 do you think you could update the uninstall procedure to use the stored option names and delete_option instead?

seezee commented 5 years ago

uninstall.txt

I've tested this to see if it will enumerate through the options table & it works. Have not actually tried an uninstall to see if it drops the options.