wordpress小技巧 批量删除重复文章,定时状态的文章批量修改为已发布

wordpress批量删除重复文章  善意提示!建议先备份好数据再进行操作!

第一种使用插件

1. 插件:使用一款插件,名字叫做Delete Duplicate Posts

2. 操作数据库:

CREATE TABLE my_tmp AS SELECT MIN(ID) AS col1 FROM wp_posts GROUP BY post_title;
DELETE FROM wp_posts WHERE ID NOT IN (SELECT col1 FROM my_tmp);
DROP TABLE my_tmp;

3.php程序代码删除

require('./wp-load.php');
$strsql="create table my_tmp as select min(ID) as col1 from cd_posts group by post_title";
$strsql1="delete from cd_posts where ID not in (select col1 from my_tmp)";
$strsql2="drop table my_tmp";
$result=mysql_query($strsql);
$result=mysql_query($strsql1);
$result=mysql_query($strsql2);

保存以上代码以为delete.php,放在根目录,想要删除重复文章的时候,访问这个文件就可以了

还有一种
mysql -uroot -p

use wordpress;

CREATE TABLE my_tmp AS SELECT MIN(ID) AS col1 FROM wp_posts GROUP BY post_title;

DELETE FROM wp_posts WHERE ID NOT IN (SELECT col1 FROM my_tmp);

DROP TABLE my_tmp;

exit

以上方法都可以!

下面是

wordpress定时状态的文章批量修改为已发布


mysql -uroot -p

use wordpress;

UPDATE `wp_posts`

SET `post_status` ='publish' WHERE (`post_status`='future');

exit

 

世间万物皆是虚幻,存在只有暂时的意义。没毅力,大事无能,中事不成。

wordpress小技巧 批量删除重复文章,定时状态的文章批量修改为已发布:等您坐沙发呢!

发表评论

表情
还能输入210个字