WordPress-Plugin-Template
WordPress-Plugin-Template copied to clipboard
proposal for a universal uninstall script to clean up after plugin is deleted
Hello, I would like to propose the following uninstall.php
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
//change your plugin prefix here
delete_options_prefixed( 'test_' );
function delete_options_prefixed( $prefix ) {
global $wpdb;
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '{$prefix}%'" );
}
Hey @alekseyn1 thanks for this.
Are you able to open a pull request with these changes. I can't guarantee I will be able to merge it very soon, but if it's open I can at least try and prioritise it.
Done :-)