WordPress批量修改文章发布时间

SQL

UPDATE `wp_posts` SET `post_date` = DATE_ADD('2014-1-01', INTERVAL ROUND(RAND() * 500 + 1) DAY)  WHERE `ID` between 6297 AND 14332;
update `wp_posts` set `post_modified` = `post_date` WHERE `ID` between 1 AND 1000;
update `wp_posts` set `post_date_gmt` = `post_date` WHERE `ID` between 1 AND 1000;
update `wp_posts` set `post_modified_gmt` = `post_modified` WHERE `ID` between 1 AND 1000;
update `wp_posts` set `post_status` = 'publish' WHERE `ID` between 1 AND 1000;

SQL语句详解

UPDATE `wp_posts` SET `post_date` = DATE_ADD('起始时间', INTERVAL ROUND(RAND() * 随即日期范围单位:天 + 1) DAY)  WHERE `ID` between 6297 AND 14332;
update `wp_posts` set `post_modified` = `post_date` WHERE `ID` between 起始ID AND 结束ID;
update `wp_posts` set `post_date_gmt` = `post_date` WHERE `ID` between 起始ID AND 结束ID;
update `wp_posts` set `post_modified_gmt` = `post_modified` WHERE `ID` between 起始ID AND 结束ID;
update `wp_posts` set `post_status` = 'publish' WHERE `ID` between 起始ID AND 结束ID;

相关链接

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享