Difference between revisions of "Wordpress Comment Junk"
From KOP KB
m (ReMaster moved page Wordpres Comment Junk to Wordpress Comment Junk without leaving a redirect) |
|||
Line 4: | Line 4: | ||
Use the following command to look at “junk” entries. It also shows the number of “junk” entries. | Use the following command to look at “junk” entries. It also shows the number of “junk” entries. | ||
− | <syntaxhighlight lang="mysql"> | + | <syntaxhighlight lang="mysql" enclose="div"> |
SELECT * FROM wp_commentmeta WHERE comment_id | SELECT * FROM wp_commentmeta WHERE comment_id | ||
NOT IN ( | NOT IN ( | ||
Line 12: | Line 12: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Once satisfied, execute the following command to remove the “junk” entries. | Once satisfied, execute the following command to remove the “junk” entries. | ||
− | <syntaxhighlight lang="mysql"> | + | <syntaxhighlight lang="mysql" enclose="div"> |
DELETE FROM wp_commentmeta WHERE comment_id | DELETE FROM wp_commentmeta WHERE comment_id | ||
NOT IN ( | NOT IN ( | ||
Line 23: | Line 23: | ||
Use the following command to look at “junk” entries. It also shows number of “junk” entries. | Use the following command to look at “junk” entries. It also shows number of “junk” entries. | ||
− | <syntaxhighlight lang="mysql"> | + | <syntaxhighlight lang="mysql" enclose="div"> |
SELECT * FROM wp_commentmeta WHERE meta_key | SELECT * FROM wp_commentmeta WHERE meta_key | ||
LIKE "%akismet%" | LIKE "%akismet%" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Once satisfied, execute the following command to remove the “junk” entries. | Once satisfied, execute the following command to remove the “junk” entries. | ||
− | <syntaxhighlight lang="mysql"> | + | <syntaxhighlight lang="mysql" enclose="div"> |
DELETE FROM wp_commentmeta WHERE meta_key | DELETE FROM wp_commentmeta WHERE meta_key | ||
LIKE "%akismet%" | LIKE "%akismet%" | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 18:24, 14 January 2015
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%"