Hi I've wrote a plugin it works but on deactivation it doesn't drop the plugin tables from db
this is the code

                //$e = $wpdb->query($sql);

and i call that function this way
register_deactivation_hook(FILE, 'deactivate');

if i uncomment to show message error it tells me on deativation


whiy doesn't it drop the table?? could you help me to fix it??
thank you

Recommended Answers

All 3 Replies

Check this code. Bit different than yours.

with this code it worked!!

global $wpdb;   //required global declaration of WP variable

    $table_name = $wpdb->prefix.$table_name;

    $sql = "DROP TABLE ". $table_name;


thank you!!

Nice. Mark it as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.