0

I'm new in Wordpress and I have a function that drop the tables of my plugin on DB.

<?php

if (! defined('WP_UNINSTALL_PLUGIN')) {
exit;
}

// Uninstallation actions here

global $wpdb;

$table_names = [
    $wpdb->prefix . "questions",
    $wpdb->prefix . "difficulties",
    $wpdb->prefix . "modalities",
    $wpdb->prefix . "fields",
    $wpdb->prefix . "themes",
    $wpdb->prefix . "subjects",
    $wpdb->prefix . "disciplines",
    $wpdb->prefix . "training_areas",
    $wpdb->prefix . "levels",
    $wpdb->prefix . "roles",
    $wpdb->prefix . "banks",
];

foreach ($table_names as $table_name) {
    $wpdb->query("DROP TABLE IF EXISTS $table_name");
}

But when I delete the plugin on admin, it shows this error: enter image description here

It does drop all the tables, but how I make to stop this error?

1 Answer 1

1

Plugin - it is not only tables in database, but also files. Such an error usually occurs when rights in the filesystem are not properly set. Rights must be 644 for files and 755 for directories, and owner must be the same user, under which php is running.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.