Uninstalling a plugin: delete all options with specific prefix

Objective As all plugin developer, I want to delete all options that begin with the same prefix. Backstory I’ve developed a plugin that stores data in the options. When the user uninstalls the plugin, the uninstall.php in the plugin executes the following code: if ( !defined( ‘WP_UNINSTALL_PLUGIN’ ) ) { exit; } delete_option( ‘myplugin_some_opt_1’ ); … Read more

How can I remove a package from Laravel using PHP Composer?

What is the correct way to remove a package from Laravel using PHP Composer? So far I’ve tried: Remove declaration from file composer.json (in the “require” section) Remove any class aliases from file app.php Remove any references to the package from my code 🙂 Run composer update Run composer dump-autoload None of these options are … Read more

register_uninstall_hook() vs uninstall.php – which one is better way to handle plugin uninstallation script?

today while looking inside WP Codex, I saw two ways to handle plugin uninstall scripts (like deletings, options, data, tables etc.). One way is using register_uninstall_hook() and the other is by using the simple uninstall.php. Though the codex page gives a lot of info about both of them, but it doesn’t say what is the … Read more

Uninstall, Activate, Deactivate a plugin: typical features & how-to

I’m making a WordPress plugin. What are typical things I should include in the uninstall feature? For example, should I delete any tables I created in the install function? Do I clean up my option entries? Anything else? There are three different hooks. They trigger in the following cases: Uninstall Deactivation Activation How-to trigger functions … Read more