首页 > 解决方案 > Wordpress CLI “Warning: Some code is trying to do a URL redirect.” error

问题描述

I'm using WP CLI to manage the cron tasks of my Wordpress installation. Was working well, but now I'm getting the error:

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]

Any tips?

标签: wordpresscronwp-cli

解决方案


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

--skip-plugins=w3-total-cache

我现在工作:

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

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


推荐阅读