MySql 數據庫 SQL 命令指定時間範圍批量隨機修改 WordPress 文章發佈時間

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 6297 AND 14332;
update `wp_posts` set `post_date_gmt` = `post_date` WHERE `ID` between 6297 AND 14332;
update `wp_posts` set `post_modified_gmt` = `post_modified` WHERE `ID` between 6297 AND 14332;
update `wp_posts` set `post_status` = 'publish' WHERE `ID` between 6297 AND 14332;

自己修改好起始時間 「2014-01-01」 、隨機日期範圍 「500 天」 、文章 ID 範圍起始 ID 6297 結束 ID 14332 修改為你自己的

然後依次執行以上 SQL 語句即可,可以隨機生成 ID 範圍內的文章的發佈日期