WordPress-Plugin-Template icon indicating copy to clipboard operation
WordPress-Plugin-Template copied to clipboard

proposal for a universal uninstall script to clean up after plugin is deleted

Open alekseyn1 opened this issue 6 years ago • 2 comments

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}%'" );
}

alekseyn1 avatar Feb 16 '19 06:02 alekseyn1

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.

jonathanbossenger avatar Mar 13 '19 07:03 jonathanbossenger

Done :-)

alekseyn1 avatar Mar 16 '19 01:03 alekseyn1