简体   繁体   English

wp-cli search-replace命令未搜索和替换

[英]wp-cli search-replace command not searching and replacing

I'm using wp-cli tool for searching and replacing the site's url to a new url. 我正在使用wp-cli工具搜索网站的网址并将其替换为新的网址。 I'm executing this command in command line in the directory of the wordpress installation: 我正在wordpress安装目录的命令行中执行以下命令:

C:\xampp\htdocs\somewebsite>wp search-replace 'somewebsite.com' 'new_website.com' 

the command does not issue any errors, and when i check the database with this sql: 该命令不会发出任何错误,并且当我使用此sql检查数据库时:

SELECT * FROM wp_options WHERE option_value LIKE '%new_website.com%'

I get zero results. 我得到零结果。

I have the the username, password, db name, location set correctly in wp.config file. 我在wp.config文件中正确设置了用户名,密码,数据库名称和位置。

EDIT 编辑

By any chance does this have to do with the sql file permissions? 碰巧这与sql文件权限有关吗?

EDIT Ok it wp-cli did not work for me but https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ did. 编辑好吧,wp-cli对我不起作用,但是https://interconnectit.com/products/search-and-replace-for-wordpress-databases/可以 Make sure you use the stable version as of this writing which is: v2.1.0 STABLE. 确保在撰写本文时使用的稳定版本为:v2.1.0 STABLE。

我只是遇到了同样的问题,问题是Windows命令提示符中的单引号-以下内容对我有用:

wp search-replace "somewebsite.com" "new_website.com"

Your syntax looks correct. 您的语法看起来正确。 Try adding --verbose to the end of your search-replace command and check the output. 尝试在搜索替换命令的末尾添加--verbose并检查输出。 All wp-cli search-replace options can be found here: http://wp-cli.org/commands/search-replace/ 所有wp-cli搜索替换选项都可以在这里找到: http : //wp-cli.org/commands/search-replace/

You need to check your wp-config.php thoroughly. 您需要彻底检查wp-config.php For me I was loading wp-settings.php twice which is the reason why there was no output at all because there were errors behind the scenes. 对我来说,我两次加载了wp-settings.php ,这就是为什么根本没有输出的原因,因为幕后有错误。 You need to set define('WP_DEBUG', true); 您需要设置define('WP_DEBUG', true); to see the errors and you can start fixing your wp-config.php from there. 要查看错误,您可以从那里开始修复wp-config.php

I ran into a similar problem a while ago. 不久前,我遇到了类似的问题。 As it turned out, I did not have the current wp-cli version installed. 事实证明,我没有安装当前的wp-cli版本。 I was typing correct syntax, but the command was not executing, and no errors were returned. 我输入了正确的语法,但是命令未执行,并且未返回任何错误。

wp cli check-update

wp cli update

after I updated to version 1.0 I no longer had any problems. 更新到1.0版后,我不再遇到任何问题。

Just a thought. 只是一个想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM