Skip to content

Instantly share code, notes, and snippets.

@nateware
Created November 4, 2009 17:47
Show Gist options
  • Save nateware/226241 to your computer and use it in GitHub Desktop.
Save nateware/226241 to your computer and use it in GitHub Desktop.
Bulk updating Wordpress comments
-- Bulk updating your pending Wordpress comments as spam when you have thousands of them.
mysql> select comment_approved, count(*) from wp_comments group by comment_approved;
+------------------+----------+
| comment_approved | count(*) |
+------------------+----------+
| 0 | 2052 |
| 1 | 3 |
| spam | 441 |
+------------------+----------+
3 rows in set (0.01 sec)
mysql> update wp_comments set comment_approved = 'spam' where comment_approved = 0;
Query OK, 2052 rows affected (0.25 sec)
Rows matched: 2493 Changed: 2052 Warnings: 0
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment