Search code examples
wordpresswp-cli

I cannot activate or deactivate plugins in wp-admin area or using wp-cli


I have a problem on a client's live WordPress site where I am unable to activate or deactivate plugins. I am an administrator and used to be able to do this. I can add new plugins but not activate.

I'd be grateful for any insight into what I can try next.

I am using v5.2.4 of WordPress with v7.3 of PHP and MariaDB.

In wp-admin when I try to activate a plugin, I see a Successfully Activated message but nothing has actually happened. I see the same behaviour in wp-cli. See pasted code below.

I've seen posts where others had the same problem.

One suggested answer is to delete all plugins from the file system. I am reluctant to do this as it is a live client site, but I have deactivated mainwp-child as it does not affect visitors to the site.

The other suggested answer is that maybe the options table in the database has become corrupted. I was able to update the active_plugins record in the database to deactivate a plugin, so I don't think it is this.

linuxuser@aws-server:~/files$ wp plugin list
+-------------------------------+----------+--------------------------------+------------+
| name                          | status   | update                         | version    |
+-------------------------------+----------+--------------------------------+------------+
| all-in-one-wp-security-and-fi | inactive | none                           | 4.4.2      |
| rewall_old_                   |          |                                |            |
| classic-editor                | active   | none                           | 1.5        |
| contact-form-7                | active   | none                           | 5.1.5      |
| youtube-embed-plus            | active   | none                           | 13.1.2.1   |
| google-analytics-for-wordpres | active   | none                           | 7.10.0     |
| s                             |          |                                |            |
| limit-login-attempts-reloaded | inactive | none                           | 2.9.0      |
| rankya-localbusiness-markup-s | active   | none                           | 1.1        |
| chema                         |          |                                |            |
| mainwp-child                  | active   | none                           | 4.0.4      |
| spinupwp                      | active   | none                           | 1.1.2      |
| stream                        | inactive | none                           | 3.4.2      |
| updraftplus                   | active   | version higher than expected   | 2.16.20.24 |
| vc_clipboard                  | active   | none                           | 3.25       |
| js_composer                   | active   | none                           | 6.0.5      |
| goodbye-captcha               | active   | none                           | 3.1.34     |
| wp-bruiser-contactform7       | active   | none                           | 3.1.34     |
| wp-mail-smtp                  | active   | none                           | 1.7.1      |
| wordpress-seo                 | active   | none                           | 12.5       |
| spinupwp-debug-log-path       | must-use | none                           | 1.0        |
| object-cache.php              | dropin   | none                           |            |
+-------------------------------+----------+--------------------------------+------------+

I managed to deactivate all-in-one-wp-security-and-firewall by renaming it and updating the options table in the database. I want to activate limit-login-attempts-reloaded

linuxuser@aws-server:~/files$ wp plugin activate limit-login-attempts-reloaded
Plugin 'limit-login-attempts-reloaded' activated.
Success: Activated 1 of 1 plugins.

But it didn't:

+-------------------------------+----------+--------------------------------+------------+
| name                          | status   | update                         | version    |
+-------------------------------+----------+--------------------------------+------------+
| all-in-one-wp-security-and-fi | inactive | none                           | 4.4.2      |
| rewall_old_                   |          |                                |            |
| classic-editor                | active   | none                           | 1.5        |
| contact-form-7                | active   | none                           | 5.1.5      |
| youtube-embed-plus            | active   | none                           | 13.1.2.1   |
| google-analytics-for-wordpres | active   | none                           | 7.10.0     |
| s                             |          |                                |            |
| limit-login-attempts-reloaded | inactive | none                           | 2.9.0      |
| rankya-localbusiness-markup-s | active   | none                           | 1.1        |
| chema                         |          |                                |            |
| mainwp-child                  | active   | none                           | 4.0.4      |
| spinupwp                      | active   | none                           | 1.1.2      |
| stream                        | inactive | none                           | 3.4.2      |
| updraftplus                   | active   | version higher than expected   | 2.16.20.24 |
| vc_clipboard                  | active   | none                           | 3.25       |
| js_composer                   | active   | none                           | 6.0.5      |
| goodbye-captcha               | active   | none                           | 3.1.34     |
| wp-bruiser-contactform7       | active   | none                           | 3.1.34     |
| wp-mail-smtp                  | active   | none                           | 1.7.1      |
| wordpress-seo                 | active   | none                           | 12.5       |
| spinupwp-debug-log-path       | must-use | none                           | 1.0        |
| object-cache.php              | dropin   | none                           |            |
+-------------------------------+----------+--------------------------------+------------+

This is the update statement I ran and committed in the database:

update options 
set option_value = 'a:15:{i:0;s:33:"classic-editor/classic-editor.ph
p";i:1;s:36:"contact-form-7/wp-contact-form-7.php";i:2;s:35:"goodbye-ca
ptcha/goodbye-captcha.php";i:3;s:50:"google-analytics-for-wordpress/goo
gleanalytics.php";i:4;s:27:"js_composer/js_composer.php";i:5;s:29:"main
wp-child/mainwp-child.php";i:6;s:73:"rankya-localbusiness-markup-schema
/rankya-localbusiness-markup-schema.php";i:7;s:21:"spinupwp/spinupwp.ph
p";i:8;s:17:"stream/stream.php";i:9;s:27:"updraftplus/updraftplus.php"
;i:10;s:29:"vc_clipboard/vc_clipboard.php";i:11;s:24:"wordpress-seo/wp-
seo.php";i:12;s:51:"wp-bruiser-contactform7/wp-bruiser-contactform7.php
";i:13;s:29:"wp-mail-smtp/wp_mail_smtp.php";i:14;s:30:"youtube-embed-pl
us/youtube.php";}'
where option_name = 'active_plugins';

The plugin is still displayed in the output from wp-cli though:

array (
  0 => 'goodbye-captcha/goodbye-captcha.php',
  1 => 'all-in-one-wp-security-and-firewall/wp-security.php',
  2 => 'classic-editor/classic-editor.php',
  3 => 'contact-form-7/wp-contact-form-7.php',
  4 => 'google-analytics-for-wordpress/googleanalytics.php',
  5 => 'js_composer/js_composer.php',
  6 => 'mainwp-child/mainwp-child.php',
  7 => 'rankya-localbusiness-markup-schema/rankya-localbusiness-markup-schema.php',
  8 => 'spinupwp/spinupwp.php',
  9 => 'updraftplus/updraftplus.php',
  10 => 'vc_clipboard/vc_clipboard.php',
  11 => 'wordpress-seo/wp-seo.php',
  12 => 'wp-bruiser-contactform7/wp-bruiser-contactform7.php',
  13 => 'wp-mail-smtp/wp_mail_smtp.php',
  14 => 'youtube-embed-plus/youtube.php',
)

It is not in the database active_plugins (select statement run after mainwp_child deactivated):

MariaDB [dbname]> select option_value
    -> from pfx_options
    -> where option_name = 'active_plugins';
| option_value              
| a:13:{i:0;s:35:"goodbye-captcha/goodbye-captcha.php";i:2;s:33:"classic-editor/classic-ed
itor.php";i:3;s:36:"contact-form-7/wp-contact-form-7.php";i:4;s:50:"google-analytics-for-w
ordpress/googleanalytics.php";i:5;s:27:"js_composer/js_composer.php";i:7;s:73:"rankya-loca
lbusiness-markup-schema/rankya-localbusiness-markup-schema.php";i:8;s:21:"spinupwp/spinupw
p.php";i:9;s:27:"updraftplus/updraftplus.php";i:10;s:29:"vc_clipboard/vc_clipboard.php";i:
11;s:24:"wordpress-seo/wp-seo.php";i:12;s:51:"wp-bruiser-contactform7/wp-bruiser-contactfo
rm7.php";i:13;s:29:"wp-mail-smtp/wp_mail_smtp.php";i:14;s:30:"youtube-embed-plus/youtube.p
hp";} |

If you've made it this far, thank you. If you've any ideas I'd really be glad to try them.

Kind regards,

Anita


Solution

  • As I mentioned at the comment section of question, it looks like a cache issue.

    In this very example it was probably related to object-cache.php and/or as you evaluated the Breeze. I cannot say something specific without reproducing the problem.

    However, IMHO, while playing in production, if you change something in code and can't see the assumed output, it is most probably cached or you changed the wrong file or your code has not been deployed.

    Bets are always on cache. Good luck next time.