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( $...
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 ...
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.
...
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 ...
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 ( ...
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 ...
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.
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 ...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
uninstallation × 54plugins × 27
plugin-development × 16
installation × 5
multisite × 4
theme-development × 3
child-theme × 3
custom-post-types × 2
php × 2
functions × 2
customization × 2
custom-taxonomy × 2
widgets × 2
options × 2
posts × 1
themes × 1
ajax × 1
database × 1
hooks × 1
users × 1
post-meta × 1
query × 1
terms × 1
htaccess × 1
rest-api × 1