Title: Plugin uninstallation does not work!
Last modified: August 19, 2016

---

# Plugin uninstallation does not work!

 *  Resolved [lelkoun](https://wordpress.org/support/users/lelkoun/)
 * (@lelkoun)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-uninstallation-does-not-work/)
 * Uninstalling a plugin after deleting it for some unknown reason does not work.
   This is my code:
 *     ```
       function sb_uninstall_plugin(){
       	global $wpdb, $sb_ip_log;
   
       	delete_option("sb_detection_of_spammers_cookies");
       	delete_option("sb_detection_of_spammers_time");
       	delete_option("sb_banned_message");
       	$wpdb->query("DROP TABLE $sb_ip_log");
       }
   
       register_uninstall_hook(__FILE__, 'sb_uninstall_plugin');
       ```
   
 * The value of the option _uninstall\_plugins_ in the table wp_options: a:2:{i:
   0;b:0;s:22:”sb/spammer-blocker.php”;s:19:”sb_uninstall_plugin”;}
 * I also tried using uninstall.php without any success.
    **Thank you for your help!**

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [lelkoun](https://wordpress.org/support/users/lelkoun/)
 * (@lelkoun)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-uninstallation-does-not-work/#post-2050628)
 * Solved.
 *  [zamb0n](https://wordpress.org/support/users/zamb0n/)
 * (@zamb0n)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-uninstallation-does-not-work/#post-2050805)
 * hello, can you please state how you solved your problem?
 * i want to make an uninstall.php file to uninstall some tables i have created 
   in the database when i delete the plugin. cant get it to work…
 * thank you
 *  Thread Starter [lelkoun](https://wordpress.org/support/users/lelkoun/)
 * (@lelkoun)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-uninstallation-does-not-work/#post-2050806)
 * Currently I use only uninstall.php. This is an example how it can look like: 
   [http://pastebin.com/usLWQCq2](http://pastebin.com/usLWQCq2)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Plugin uninstallation does not work!’ is closed to new replies.

## Tags

 * [register_uninstall_hook](https://wordpress.org/support/topic-tag/register_uninstall_hook/)
 * [uninstall.php](https://wordpress.org/support/topic-tag/uninstall-php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 2 participants
 * Last reply from: [lelkoun](https://wordpress.org/support/users/lelkoun/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-uninstallation-does-not-work/#post-2050806)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
