Difference between revisions of "Wordpress Comment Junk"

From KOP KB
Jump to: navigation, search
(Created page with "1.) Clean up “wp_commentmeta” entries which have no relation to wp_comments Use the following command to look at “junk” entries. It also shows the number of “junk...")
 
Line 1: Line 1:
 +
Source: http://www.internetearnings.com/how-to-clean-up-comment-meta-in-wordpress-database/
 +
 
1.) Clean up “wp_commentmeta” entries which have no relation to wp_comments
 
1.) Clean up “wp_commentmeta” entries which have no relation to wp_comments
  

Revision as of 17:52, 30 October 2014

Source: http://www.internetearnings.com/how-to-clean-up-comment-meta-in-wordpress-database/

1.) Clean up “wp_commentmeta” entries which have no relation to wp_comments

Use the following command to look at “junk” entries. It also shows the number of “junk” entries.

SELECT * FROM wp_commentmeta WHERE comment_id
NOT IN (
SELECT comment_id
FROM wp_comments
)

Once satisfied, execute the following command to remove the “junk” entries.

DELETE FROM wp_commentmeta WHERE comment_id
NOT IN (
SELECT comment_id
FROM wp_comments
)

After optimizing the database, the table size drop to ~5MB. 2.) Clean up Akismet related metadata in wp_commentmeta table.

Use the following command to look at “junk” entries. It also shows number of “junk” entries.

SELECT * FROM wp_commentmeta WHERE meta_key
LIKE "%akismet%"

Once satisfied, execute the following command to remove the “junk” entries.

DELETE FROM wp_commentmeta WHERE meta_key
LIKE "%akismet%"