WordPress更换域名/批量修改文章内容/文章标题/标签TAG

WordPress批量替换文章内容/文章标题/标签TAG,打开MYSQL,执行以下命令:

注意:在执行任何数据库批量修改前一定记得备份数据库,如果操作失误就还原数据库,一定,一定,一定

1、批量替换文章内容

update wp_posts set post_content = replace(post_content,'cwhello.com','重蔚自留地')

批量将文章中的 cwhello.com 替换成 重蔚自留地

2、批量替换文章标题

update wp_posts set post_title = replace(post_title,'cwhello.com','重蔚自留地')

批量将标题中的cwhello.com替换成重蔚自留地

3、批量替换下载地址中的制定字符

update wp_postmeta set meta_value = replace(meta_value,'cwhello.com','www.cwhello.com')

批量将下载地址中的cwhello.com替换成www.cwhello.com

4、批量替换TAG标签

update wp_terms set name = replace(name,'cwhello.com','重蔚自留地')

批量将TAG中的 cwhello.com 替换成 重蔚自留地

5、wordpress更换域名或者变更ssl,由http变为https


更换域名:

on_value = replace(option_value, 'cwhello.com','www.cwhello.com') ;
UPDATE wp_posts SET post_content = replace(post_content, 'cwhello.com','www.cwhello.com') ;
UPDATE wp_comments SET comment_content = replace(comment_content, 'cwhello.com', 'www.cwhello.com') ;
UPDATE wp_comments SET comment_author_url = replace(comment_author_url, 'cwhello.com', 'www.cwhello.com') ;

以上代码中,cwhello.com 代表原来的域名,www.cwhello.com 代表新域名。
域名一定要输入完整;如果你使用类似 blog.cwhello.com 这样的二级域名,也是可以的,只要输入完整域名就可以了。

由http变为https(一般适用于网站后来使用了ssl):

on_value = replace(option_value, 'cwhello.com','www.cwhello.com') ;
UPDATE wp_posts SET post_content = replace(post_content, 'http://','https://') ;
UPDATE wp_comments SET comment_content = replace(comment_content, 'http://','https://') ;
UPDATE wp_comments SET comment_author_url = replace(comment_author_url, 'http://','https://') ;

本文来自投稿,不代表科技代码立场,如若转载,请注明出处https://www.cwhello.com/37293.html

如有侵犯您的合法权益请发邮件951076433@qq.com联系删除

(0)
上一篇 2022年9月14日 23:59
下一篇 2022年9月26日 22:57

相关推荐

联系我们

QQ:951076433

在线咨询:点击这里给我发消息邮件:951076433@qq.com工作时间:周一至周五,9:30-18:30,节假日休息