How To Drop ClipBucket Plugin DB Table On Plugin Uninstall

13 views October 18, 2016 Saqib Razzaq 0

If your plugin creates a new table on installation to store its data, you must drop that table when plugin is uninstalled because when plugin is not working, that table is not required at all. Here is how you can do it.

Step 1:

Create new php file in your plugin folder and name it uninstall_plugin_name.php

Step 2:

Add follow code into that file.

<?php
	function un_install_plugin_name()
	{
		global $db;
		$db->Execute(
		'DROP TABLE '.tbl("plugin_table_name ").''
		);
	}
	un_install_plugin_name();
?>
Save it.

Step 3:

Now uninstall your plugin and you won’t see that table in Database anymore. Have fun.

Was this helpful?