8 votes

Uninstalling a plugin: delete all options with specific prefix

Replace "myplugin_" with your prefix: global $wpdb; $plugin_options = $wpdb->get_results( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE 'myplugin_%'" ); foreach( $...
Nate Allen's user avatar
  • 2,076
7 votes
Accepted

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

The benefit of uninstall.php, and the reason that it was introduced, is that it allows you to isolate your uninstallation code from the rest of your plugin's code. This means that your entire plugin ...
J.D.'s user avatar
  • 3,915
5 votes
Accepted

Delete options from all blogs on plugin uninstall from a network/multisite

Because it is a wiki, the codex is a notoriously unreliable source of information (but you probably already knew that). However, it is probably true that uninstalling on huge networks will not scale. ...
J.D.'s user avatar
  • 3,915
4 votes

How can I delete options with register_uninstall_hook?

Inside the main plugin file: // plugin activation register_activation_hook( __FILE__, 'my_fn_activate' ); function my_fn_activate() { add_option( 'my_plugin_option', 'some-value' ); } // plugin ...
Arsen K.'s user avatar
  • 146
3 votes
Accepted

Uninstalling a plugin: delete all options with specific prefix

I've found out another alternative by using the wp_load_alloptions() function to get all of the available options, then delete_option() for every option that has the myplugin_ prefix: foreach ( ...
Ethan O'Sullivan's user avatar
2 votes

Plugin could not be deleted due to an error: Could not fully remove the plugin(s) my-plugin/my-plugin.php

I also had the same problem. It was due to the permission issue in wordpress directory. Navigate to the Directory where you have installed WordPress and…. run the following in your terminal: sudo ...
Annapurna's user avatar
  • 324
2 votes
Accepted

Plugin retrieving results even after uninstallation

WordPress v4.7 has added the REST API into core, so this might explain why your REST functionality is still available even after uninstalling the REST API plugin.
Dave Romsey's user avatar
  • 17.7k
1 vote
Accepted

UnInstallation of a Plugin from a developers perspective - The correct and clean method

They’re just two different ways of doing the same thing. It’s up to you which one to use, or whether to use both. Neither is ‘correct’. Use whichever makes more sense to you with the structure of your ...
Jacob Peattie's user avatar
1 vote

plugin uninstall function drop the tables, but shows errors on admin

Plugin - it is not only tables in database, but also files. Such an error usually occurs when rights in the filesystem are not properly set. Rights must be 644 for files and 755 for directories, and ...
KAGG Design's user avatar
  • 1,842
1 vote

How Do I Uninstall a Current WordPress Theme and Install a Fresh Theme

You can install the new theme and preview how it would look before changing it. See https://en.support.wordpress.com/themes/#preview-themes for more info. Once you have tested that it works, you can ...
TomC's user avatar
  • 1,291
1 vote

Where could I see uninstallation directives for a plugin?

WordPress uses two methods to unistall plugin: uninstall.php file in plugin's root folder. If file exists, it is executed and second method is not used. A function registered by plugin via ...
KAGG Design's user avatar
  • 1,842
1 vote
Accepted

One of my plugins broke when I tried to update it, how do I safely uninstall it?

If you just want to delete Yoast SEO manually so you need to login into your server and delete the following folder: .../wp-content/plugins/wordpress-seo So you will delete the directory wordpress-...
filipecsweb's user avatar
  • 1,005
1 vote

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

Well, it depends on what you want. register_uninstall_hook() creates hooks and it executes when the uninstall link clicked. That means it actually create a hook which will be called on clicking the ...
CodeMascot's user avatar
  • 4,527
1 vote
Accepted

Clearing caches on plugin uninstall

There are different approaches to this, depending on specific requirements. For example in your case you seem more worried about plugin picking up ghost data than that data being left behind. Such ...
Rarst's user avatar
  • 99.7k

Only top scored, non community-wiki answers of a minimum length are eligible