Wordpress CLI“警告:某些代码正在尝试进行URL重定向”错误

问题描述

我正在使用WP CLI来管理wordpress安装的cron任务。运作良好,但现在出现错误

Warning: Some code is trying to do a URL redirect. Backtrace:
#0  WP_CLI\Utils\wp_redirect_handler(https://example.com.br) called at [/home/user/public_html/wp-includes/class-wp-hook.PHP:289]
#1  WP_Hook->apply_filters(https://example.com.br,Array ([0] => https://example.com.br,[1] => 301)) called at [/home/user/public_html/wp-includes/plugin.PHP:206]
#2  apply_filters(wp_redirect,https://example.com.br,301) called at [/home/user/public_html/wp-includes/pluggable.PHP:1257]
#3  wp_redirect(https://example.com.br,301) called at [/home/user/public_html/wp-content/plugins/w3-total-cache/PgCache_Plugin.PHP:214]
#4  W3TC\PgCache_Plugin->redirect_on_foreign_domain() called at [/home/user/public_html/wp-includes/class-wp-hook.PHP:287]
#5  WP_Hook->apply_filters(,Array ([0] => )) called at [/home/user/public_html/wp-includes/class-wp-hook.PHP:311]
#6  WP_Hook->do_action(Array ([0] => )) called at [/home/user/public_html/wp-includes/plugin.PHP:478]
#7  do_action(init) called at [/home/user/public_html/wp-settings.PHP:546]
#8  require(/home/user/public_html/wp-settings.PHP) called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/PHP/WP_CLI/Runner.PHP:1237]
#9  WP_CLI\Runner->load_wordpress() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/PHP/WP_CLI/Runner.PHP:1158]
#10 WP_CLI\Runner->start() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/PHP/WP_CLI/Bootstrap/LaunchRunner.PHP:23]
#11 WP_CLI\Bootstrap\LaunchRunner->process(WP_CLI\Bootstrap\BootstrapState Object ([WP_CLI\Bootstrap\BootstrapStatestate] => Array ())) called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/PHP/bootstrap.PHP:74]
#12 WP_CLI\bootstrap() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/PHP/wp-cli.PHP:27]
#13 include(phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/PHP/wp-cli.PHP) called at [phar:///usr/local/bin/wp/PHP/boot-phar.PHP:11]
#14 include(phar:///usr/local/bin/wp/PHP/boot-phar.PHP) called at [/usr/local/bin/wp:4]

有什么提示吗?

解决方法

使用Google搜索,我意识到问题出在W3 Total Cache插件上,并使用了以下选项:

--skip-plugins=w3-total-cache

我现在正在工作:

wp cron event run --due-now --skip-plugins=w3-total-cache

应该与其他任何显示相同错误的插件一起使用