Title: cannot delete plugin
Last modified: February 22, 2024

---

# cannot delete plugin

 *  Resolved [willemb2](https://wordpress.org/support/users/willemb2/)
 * (@willemb2)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/cannot-delete-plugin-26/)
 * I can deactivate the plugin, but when I try to delete it I get this line above
   the plugins page:
 * `Deletion failed: There has been a critical error on this website.Learn more 
   about troubleshooting WordPress.`
 * The site keeps working though and I don’t see anything in the logs related to
   this plugin. WP 6.4.3, PHP 8.1 on Litespeed and Plesk.
 * Can I just delete sg-security folder in wp-content/plugins/ ? Or does it leave
   entries in the database or other modifications?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcannot-delete-plugin-26%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [Plamen M](https://wordpress.org/support/users/plamenm/)
 * (@plamenm)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/cannot-delete-plugin-26/#post-17447203)
 * Hello [@willemb2](https://wordpress.org/support/users/willemb2/),
 * The plugin also adds entries to the database. The issue is most probably caused
   by some local security policy in your site, which prevents the deletion. Check
   if you have any rules, related to file writing in your **_wp-config.php_** file,
   like:
 * `**define( 'DISALLOW_FILE_EDIT', true ); **
   **define( 'DISALLOW_FILE_MODS', true)**
 * Also, if you have any other security plugin, its settings might be preventing
   the deletion process. Try disabling the other plugin temporarily.
 * If the issue persists, open the debug console in your browser and monitor for
   any errors or warnings there while recreating the issue.
 * Regards, 
   **Plamen.M**Tech Support Team SiteGround.com
 *  Thread Starter [willemb2](https://wordpress.org/support/users/willemb2/)
 * (@willemb2)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/cannot-delete-plugin-26/#post-17447260)
 * Hello [@plamenm](https://wordpress.org/support/users/plamenm/),
 * I have no problem deleting other plugins. In fact there were 2 others by Siteground:
   Speed Optimizer and ….. This site was moved from Siteground to another hosting
   about a month ago.
 * Those rules are not present in wp-config.php. But I noticed something else. Could
   this be related:
 * `/** Sets up WordPress vars and included files. */
   @include_once('/var/lib/sec/
   wp-settings-pre.php'); // Added by SiteGround WordPress management systemrequire_once
   ABSPATH . 'wp-settings.php';@include_once('/var/lib/sec/wp-settings.php'); //
   Added by SiteGround WordPress management system
 * In all my other 6 sites `wp-settings.php` is in the same folder as wp-config.
   php and none of them has a `wp-settings-pre.php`
 *  Thread Starter [willemb2](https://wordpress.org/support/users/willemb2/)
 * (@willemb2)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/cannot-delete-plugin-26/#post-17447307)
 * Hello [@plamenm](https://wordpress.org/support/users/plamenm/),
 * Here’s the wp-debug.log:
 * `[22-Feb-2024 21:52:23 UTC] PHP Fatal error: Uncaught TypeError: array_key_exists():
   Argument #1 ($key) must be a valid array offset type in /var/www/vhosts/domain.
   tld/httpdocs/wp-content/plugins/sg-security/vendor/siteground/siteground-data/
   src/Settings.php:352
   Stack trace: 0 /var/www/vhosts/domain.tld/httpdocs/wp-content/
   plugins/sg-security/vendor/siteground/siteground-data/src/Settings.php(352): 
   array_key_exists(Array, Array) 1 /var/www/vhosts/domain.tld/httpdocs/wp-content/
   plugins/sg-security/vendor/siteground/siteground-data/src/Settings.php(292): 
   SiteGround_Data\Settings->get_hosting_provider() 2 /var/www/vhosts/domain.tld/
   httpdocs/wp-content/plugins/sg-security/vendor/siteground/siteground-data/src/
   Settings.php(213): SiteGround_Data\Settings->get_main_data() 3 /var/www/vhosts/
   domain.tld/httpdocs/wp-content/plugins/sg-security/vendor/siteground/siteground-
   data/src/Settings.php(139): SiteGround_Data\Settings->prepare_data() 4 /var/www/
   vhosts/domain.tld/httpdocs/wp-content/plugins/sg-security/vendor/siteground/siteground-
   data/src/Settings.php(126): SiteGround_Data\Settings->send_data() 5 /var/www/
   vhosts/domain.tld/httpdocs/wp-content/plugins/sg-security/uninstall.php(49): 
   SiteGround_Data\Settings->stop_collecting_data() 6 /var/www/vhosts/domain.tld/
   httpdocs/wp-admin/includes/plugin.php(1245): include_once('/var/www/vhosts…')
   7 /var/www/vhosts/domain.tld/httpdocs/wp-admin/includes/plugin.php(960): uninstall_plugin('
   sg-security/sg-…') 8 /var/www/vhosts/domain.tld/httpdocs/wp-admin/includes/ajax-
   actions.php(4748): delete_plugins(Array) 9 /var/www/vhosts/domain.tld/httpdocs/
   wp-includes/class-wp-hook.php(324): wp_ajax_delete_plugin('') 10 /var/www/vhosts/
   domain.tld/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('',
   Array) 11 /var/www/vhosts/domain.tld/httpdocs/wp-includes/plugin.php(517): WP_Hook-
   >do_action(Array) 12 /var/www/vhosts/domain.tld/httpdocs/wp-admin/admin-ajax.
   php(188): do_action('wp_ajax_delete-…') 13 {main}thrown in /var/www/vhosts/domain.
   tld/httpdocs/wp-content/plugins/sg-security/vendor/siteground/siteground-data/
   src/Settings.php on line 352
    -  This reply was modified 2 years, 3 months ago by [willemb2](https://wordpress.org/support/users/willemb2/).
 *  Plugin Support [Plamen M](https://wordpress.org/support/users/plamenm/)
 * (@plamenm)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/cannot-delete-plugin-26/#post-17447431)
 * Since your site is on a different host, you should remove the includes commented
   as “Added by SiteGround WordPress management system”.
 * The debug results show that something is preventing our plugin from executing
   the Ajax Delete action. What I could suggest here is:
    1. Deactivate the plugin
    2. rename the plugin’s folder : wp-content/plugins/sg-security
    3. Clear the cache in your site and check if everything is functioning properly.
       Then you can delete the plugin’s folder also.
 * Regards,
   **Plamen.M**Tech Support TeamSiteGround.com
 *  Thread Starter [willemb2](https://wordpress.org/support/users/willemb2/)
 * (@willemb2)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/cannot-delete-plugin-26/#post-17448476)
 * Thank you, [@plamenm](https://wordpress.org/support/users/plamenm/). That worked.

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

The topic ‘cannot delete plugin’ is closed to new replies.

 * ![](https://ps.w.org/sg-security/assets/icon-256x256.gif?rev=2971855)
 * [Security Optimizer - The All-In-One Protection Plugin](https://wordpress.org/plugins/sg-security/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-security/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-security/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [willemb2](https://wordpress.org/support/users/willemb2/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/cannot-delete-plugin-26/#post-17448476)
 * Status: resolved