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: 8% [?]
Related posts:
- Duplicating WordPress Installation
- WordPress Quick Upgrade for Linux
- WordPress Backup Script
- Passing MySQL Commands from Shell Script
- MySQL Global Search and Replace Script
- Improving WordPress Performance
- The correct MySQL GRANT syntax
- Creating print.css for WordPress
- Find largest files
- Generating complex SQL queries with shell scripts



well, i have troubles installing windows7 on my PC. maybe i need a bios update or something ~”*
[Reply]
My RSS feeds create the duplicated titles for posts, but the date they are published differs. I need something that will look at the post title AND the date that title was published. If the title and date match another title and date, then I will know that it is a duplicate post.
Can anyone help? I need something free because I am making this site for work and am not allowed to purchase things for it.
[Reply]