【问题标题】:I cannot activate or deactivate plugins in wp-admin area or using wp-cli我无法在 wp-admin 区域或使用 wp-cli 激活或停用插件
【发布时间】:2019-11-15 22:18:49
【问题描述】:

我在客户的实时 WordPress 网站上遇到问题,我无法激活或停用插件。我是管理员,曾经能够做到这一点。我可以添加新插件但不能激活。

如果我能深入了解我接下来可以尝试什么,我将不胜感激。

我正在使用 v5.2.4 的 WordPress 和 v7.3 的 PHP 和 MariaDB。

在 wp-admin 中,当我尝试激活插件时,我看到一条成功激活的消息,但实际上没有发生任何事情。我在 wp-cli 中看到了相同的行为。请参阅下面粘贴的代码。

我看过其他人有同样问题的帖子。

一个建议的答案是从文件系统中删除所有插件。我不愿意这样做,因为它是一个实时客户端站点,但我已停用 mainwp-child,因为它不会影响该站点的访问者。

另一个建议的答案是数据库中的选项表可能已损坏。我能够更新数据库中的 active_plugins 记录以停用插件,所以我认为不是这个。

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                           |            |
+-------------------------------+----------+--------------------------------+------------+

我设法通过重命名all-in-one-wp-security-and-firewall 并更新数据库中的选项表来停用它。我想激活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.

但它没有:

+-------------------------------+----------+--------------------------------+------------+
| 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                           |            |
+-------------------------------+----------+--------------------------------+------------+

这是我在数据库中运行并提交的更新语句:

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';

该插件仍然显示在 wp-cli 的输出中:

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',
)

它不在数据库中active_plugins(在mainwp_child停用后运行select语句):

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";} |

如果你已经做到了,谢谢。如果您有任何想法,我真的很乐意尝试。

亲切的问候,

安妮塔

【问题讨论】:

  • 看起来像缓存问题。您可以尝试删除所有类型的缓存。和/或将WP_CACHE 文件中的WP_CACHE 设置为false,然后再次设置true
  • 谢谢。我关闭了页面缓存(不包括/wp-admin)并清除了所有缓存。同样的问题。我在wp-config.php 文件中将WP_CACHE 定义为false,并清除了对象缓存。插件正确激活。我最近从另一台服务器迁移了站点,并使用 Breeze 作为缓存解决方案。在新服务器上,有一个外部页面缓存解决方案,因此不需要 Breeze。如果我在卸载之前没有从 Breeze 中清除缓存,会不会导致这个问题?如何将您的答案标记为正确?
  • 只是添加到这个。 WP_CACHE 常量仍然是假的。在激活或停用任何插件之前,我必须清除对象缓存。奇怪但比使用数据库更容易的解决方法。

标签: wordpress wp-cli


【解决方案1】:

正如我在问题的评论部分提到的,它看起来像一个缓存问题。

在这个例子中,它可能与object-cache.php 和/或在您评估微风时有关。如果不重现问题,我无法说出具体的内容。

但是,恕我直言在生产环境中,如果您在代码中更改了某些内容并且看不到假定的输出,则很可能是缓存了,或者您更改了错误的文件或您的代码尚未部署。

投注始终在缓存中。祝你下次好运。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-02
    • 2016-10-31
    • 1970-01-01
    • 2013-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多