对WordPress文章日期进行随机修改

每次采集后发现日期都是同一天,这样是不是很傻?那我们就来修改一下!在数据库执行sql语句,2010-1-01这个是起始日期,在3890天内随机 ,1 AND 100000 这个是数据库中的wp内容id,在1到100000中间将日期随机,wp_posts是表名,如前缀修改,需要把wp修改成你所设置的前缀。

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

发表评论

电子邮件地址不会被公开。 必填项已用*标注