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 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;

PS:有时为了吸引蜘蛛爬行,经常会重新修改一下最后更改时间,蜘蛛以为文章已经更新了,就会来爬,但这种方法不适宜多次使用,有欺骗蜘蛛的风险,各位自行承担。

作者:诗无尽头i
链接:https://www.jianshu.com/p/973e6f979dd9
来源:
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

你可能感兴趣的:(WordPress批量修改文章发布时间)