wp-cli doesn’t work with qtranslate-x installed
-
The WordPress Command Line Interface (wp-cli) tool produces the following error when you use it on a site where qTranslate-x is installed.
Warning: Some code is trying to do a URL redirect. Backtrace:
#0 WP_CLI\Utils\wp_redirect_handler(https://localhost)
#1 call_user_func_array(WP_CLI\Utils\wp_redirect_handler, Array ([0] => https://localhost)) called at [/www/site/wp-includes/plugin.php:213]
#2 apply_filters(wp_redirect, https://localhost, 302) called at [/www/site/wp-includes/pluggable.php:1158]
#3 wp_redirect(https://localhost) called at [/www/site/wp-content/plugins/qtranslate-x/qtranslate_core.php:131]
#4 qtranxf_detect_language(Array ([cookie_enabled] => ,[scheme] => http,[host] => ,[path] => ,[original_url] => )) called at [/www/site/wp-content/plugins/qtranslate-x/qtranslate_core.php:64]
#5 qtranxf_init_language()
#6 call_user_func_array(qtranxf_init_language, Array ([0] => )) called at [/www/site/wp-includes/plugin.php:496]
#7 do_action(plugins_loaded) called at [phar:///usr/local/bin/wp/php/wp-settings-cli.php:249]
#8 require(phar:///usr/local/bin/wp/php/wp-settings-cli.php) called at [phar:///usr/local/bin/wp/php/wp-cli.php:26]
#9 include(phar:///usr/local/bin/wp/php/wp-cli.php) called at [phar:///usr/local/bin/wp/php/boot-phar.php:5]
#10 include(phar:///usr/local/bin/wp/php/boot-phar.php) called at [/usr/local/bin/wp:4]As soon as I removed the qtranslate-x directory from the /wp-content/plugins directory, the tool works fine.
wp-cli version: 0.19.2
qTranslate-x version: 3.4.1I did come up with a potential solution would require updating line 121 in qtranslate_core.php.
Was:
if(defined(‘WP_ADMIN’)){
Replace with:
if(defined(‘WP_ADMIN’) || defined(‘WP_CLI’)){
The change would not affect the plugin in any other way and, after making this change, the problem disappears.
I did some additional research for you on the topic. This search in Google might help.
Let me know if you have any questions or concerns or would like any additional information.
Best regards,
Michael Milette
- The topic ‘wp-cli doesn’t work with qtranslate-x installed’ is closed to new replies.