WordPress 更换站点地址后批量修改文章/评论中的旧地址

仅作记录,不建议使用。

运行以下代码即可:

前一个地址是要替换的旧地址

后一个地址是新地址

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#替换文章
update wp_posts set post_content=replace(post_content,'https://kenvix.com','https://kenvix.com');
update wp_posts set post_content=replace(post_content,'https://kenvix.com','https://kenvix.com');
update wp_posts set post_content=replace(post_content,'https://kenvix.com','https://kenvix.com');
update wp_posts set post_content=replace(post_content,'https://kenvix.com','https://kenvix.com');
update wp_posts set post_content=replace(post_content,'https://kenvix.com','https://kenvix.com');
update wp_posts set post_content=replace(post_content,'https://kenvix.com','https://kenvix.com');
#替换评论
update wp_comments set comment_content=replace(comment_content,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_content=replace(comment_content,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_content=replace(comment_content,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_content=replace(comment_content,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_content=replace(comment_content,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_content=replace(comment_content,'https://kenvix.com','https://kenvix.com');
#替换评论URL
update wp_comments set comment_author_url=replace(comment_author_url,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_author_url=replace(comment_author_url,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_author_url=replace(comment_author_url,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_author_url=replace(comment_author_url,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_author_url=replace(comment_author_url,'https://kenvix.com','https://kenvix.com');
update wp_comments set comment_author_url=replace(comment_author_url,'https://kenvix.com','https://kenvix.com');
#替换旧的本站友链
update wp_links set link_url=replace(link_url,'https://kenvix.com','https://kenvix.com');
update wp_links set link_url=replace(link_url,'https://kenvix.com','https://kenvix.com');
update wp_links set link_url=replace(link_url,'https://kenvix.com','https://kenvix.com');
update wp_links set link_url=replace(link_url,'https://kenvix.com','https://kenvix.com');
update wp_links set link_url=replace(link_url,'https://kenvix.com','https://kenvix.com');
update wp_links set link_url=replace(link_url,'https://kenvix.com','https://kenvix.com');

转载请遵守 CC BY-NC-SA 4.0 协议并注明来自:WordPress 更换站点地址后批量修改文章/评论中的旧地址

Loading...

电子邮件地址不会被公开。 必填项已用 * 标注

Powered by Kenvix Comment Server v1.0