title: Wordpress Plugin Uninstall not working
body: <p>Uninstall Hook is not working proper as when I am uninstalling the plugin, the table are not being dropped. Please help me with this. Here is the following code I am using. Please tell me what I am missing.</p>
  
  <pre><code>register_uninstall_hook( __FILE__, 'plugin_db_uninstall' );
  
  
  function plugin_db_uninstall() {
      global $wpdb;
  
      $table_name = $wpdb-&gt;prefix."user_master";  
      $wpdb-&gt;query("DROP TABLE IF EXISTS $table_name");
  
      $table_name = $wpdb-&gt;prefix."candidate_master";
      $wpdb-&gt;query("DROP TABLE IF EXISTS $table_name");
  
  
  }
  </code></pre>
  
  <p>Full Code</p>
  
  <pre><code>define('TXTFOLDER', plugins_url()."/candidate_section/txtfiles");
  
  function candidate_install () {
      if (!file_exists(TXTFOLDER)) {
          mkdir(TXTFOLDER, 0777);
      }
  }
  
  
  function candidate_section_create_table()
  {
  
      global $wpdb;
  
          $sql = 
          "CREATE TABLE IF NOT EXISTS `".$wpdb-&gt;prefix."user_master`
          (
            `id` bigint(20) NOT NULL AUTO_INCREMENT,
            `name` varchar(255) NOT NULL,
                    `email` varchar(255) NOT,NULL,
            PRIMARY KEY (`id`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
          dbDelta($sql);
  
          $sql1 = 
          "CREATE TABLE IF NOT EXISTS `".$wpdb-&gt;prefix."candidate_master` 
          (
            `id` bigint(20) NOT NULL AUTO_INCREMENT,
            `user_id` bigint(20) NOT NULL,
                    `position` varchar(255) NOT NULL,
                    `status` int(11) NOT NULL,
             PRIMARY KEY (`id`)
          )  ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
  
          dbDelta($sql1);
  
  }
  
  
  function plugin_db_uninstall() {
          global $wpdb;
  
          $table_name = $wpdb-&gt;prefix."user_master";  
          $wpdb-&gt;query("DROP TABLE IF EXISTS $table_name");
  
          $table_name = $wpdb-&gt;prefix."candidate_master";
          $wpdb-&gt;query("DROP TABLE IF EXISTS $table_name");
  
  
      }
  
  
  if (is_admin()) { 
  add_action('admin_menu', 'candidate_menu');
  register_activation_hook(__FILE__, 'candidate_install');
  register_activation_hook( __FILE__, 'candidate_section_create_table' );
  register_uninstall_hook( __FILE__, 'plugin_db_uninstall' );
  }
  </code></pre>