Delete tables from database when deleting plugin

You could do this using the WordPress uninstall.php support:

<?php
    if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit();
    global $wpdb;
    $wpdb->query( "DROP TABLE IF EXISTS NestoNovo" );
    delete_option("my_plugin_db_version");
?>

This uninstall.php file is called when your plugin is deleted.

Leave a Comment