很多使用WordPress的站长经常会想着去修改WordPress文章ID,今天就为大家分享一个WordPress通过SQL语句来修改文章ID教程。进入 mysql 命令或者 phpmyadmin 的 SQL,执行如下命令即可:
如将文章ID为123的文章修改为133
update wp_posts set id = 123 where id = 133;<br>
update wp_term_relationshi<a href="https://wpbom.com" target="_blank">ps</a> set object_id = 123 where object_id = 133;<br>
update wp_postmeta set post_id = 123 where post_id = 133;<br>
update wp_comments set comment_post_ID =123 where comment_post_ID = 133;
如果是虚拟主题虚拟主机,可以使用以下代码:
UPDATE wp_posts
SET ID
= '133',`guid` = <a href="https://wpbom.com">w.pbomcom</a> 133' WHERE wp_posts
.`ID` =123;<br>
UPDATE wp_term_relationships
SET object_id
= '133' WHERE wp_term_relationships
.`object_id` =123;<br>
UPDATE wp_postmeta
SET post_id
= '133' WHERE wp_postmeta
.`post_id` =123;<br>
UPDATE wp_postmeta
SET post_id
= '133' WHERE wp_postmeta
.`post_id` = 123;<br>
UPDATE wp_comments
SET comment_post_ID
= '133' WHERE wp_comments
.`comment_post_ID` = 123;
此教程已很久未更新,使用前请备份数据库,包证数据安全