Delete Plugin Options with Verify

Question

The process to uninstall an plugin is documented here: https://developer.wordpress.org/plugins/plugin-basics/uninstall-methods/ . The sample code there is:

// if uninstall.php is not called by WordPress, die
if (!defined('WP_UNINSTALL_PLUGIN')) {
    die;
}

$option_name = 'wporg_option';

delete_option($option_name);

// for site options in Multisite
delete_site_option($option_name);

But I can find no code samples on how to ask the user if they want to remove the plugin’s options from the wp-options table.

If I use the uninstall.php process to delete my plugin, is there an accepted/best practices way to ask the user if they want to also delete the plugin’s options? There may be an instance where the user might want to reinstall later, and not have to re-do all of the options.

0
Rick Hellewell 11 months 0 Answers 56 views 0

Leave an answer