Изтриване на коментари в WordPress (през MySQL)

Всички коментари се записват в табицата "wp_comments"

mysql> describe wp_comments;
+----------------------+---------------------+------+-----+---------------------+----------------+
| Field                | Type                | Null | Key | Default             | Extra          |
+----------------------+---------------------+------+-----+---------------------+----------------+
| comment_ID           | bigint(20) unsigned | NO   | PRI | NULL                | auto_increment |
| comment_post_ID      | bigint(20) unsigned | NO   | MUL | 0                   |                |
| comment_author       | tinytext            | NO   |     | NULL                |                |
| comment_author_email | varchar(100)        | NO   |     |                     |                |
| comment_author_url   | varchar(200)        | NO   |     |                     |                |
| comment_author_IP    | varchar(100)        | NO   |     |                     |                |
| comment_date         | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| comment_date_gmt     | datetime            | NO   | MUL | 0000-00-00 00:00:00 |                |
| comment_content      | text                | NO   |     | NULL                |                |
| comment_karma        | int(11)             | NO   |     | 0                   |                |
| comment_approved     | varchar(20)         | NO   | MUL | 1                   |                |
| comment_agent        | varchar(255)        | NO   |     |                     |                |
| comment_type         | varchar(20)         | NO   |     |                     |                |
| comment_parent       | bigint(20) unsigned | NO   | MUL | 0                   |                |
| user_id              | bigint(20) unsigned | NO   |     | 0                   |                |
+----------------------+---------------------+------+-----+---------------------+----------------+

Стойностите на колоната comment_approved са: 0 , 1, spam

# Изтриване на всички not approved коментари
DELETE FROM wp_comments WHERE comment_approved = 0;

# Изтриване на всички approved коментари
DELETE FROM wp_comments WHERE comment_approved = 1;

# Изтриване на всички спам коментари
DELETE FROM wp_comments WHERE comment_approved = 'spam';

# Изтриване по дата
DELETE FROM wp_comments WHERE comment_date > '2004-11-15 01:10:04' AND comment_date <= '2004-11-20 00:10:04'

# Изтриване на всички коментари
TRUNCATE wp_comments;

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Изтриване на коментари в WordPress (през MySQL), 5.0 out of 5 based on 1 rating

Вашият коментар

Вашият email адрес няма да бъде публикуван Задължителните полета са отбелязани с *