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

仅作记录,不建议使用。

运行以下代码即可:

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

后一个地址是新地址

#替换文章
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');

正在加载评论。你可能需要科学上网才能正常加载评论区