Remove Duplicate Posts in WordPress
Below is the SQL script that will attempt to identify and remove duplicate posts in your WordPress database. This script can be useful for autoblogging. If you use plugins like WP-o-Matic to pull full-text RSS feeds into your database, you will inevitably end up with a bunch of duplicate articles. This is not good as many search engines – including Google – frown upon duplicate content and may decide not to index much of your site.
Edit the script and add your database information. You may need to change “wp_posts” to “
#!/bin/ksh MYSQL=/usr/bin/mysql DBUSER=your_db_username DBPASS=your_db_password DBNAME=db_name $MYSQL -u$DBUSER -p$DBPASS $DBNAME << EOF DELETE bad_rows.* from wp_posts as bad_rows inner join ( select post_title, MIN(id) as min_id from wp_posts group by post_title having count(*) > 1 ) as good_rows on good_rows.post_title = bad_rows.post_title and good_rows.min_id <> bad_rows.id ; EOF
Popularity: 3% [?]




