wp_comments

Published: 3 Mar 2023

The database table wp_comments contains information about individual comments left on posts or pages on a WordPress site. This includes comment author, content, date and time when comment was made, and other basic information about the comment. Additionally, there are optional fields such as the commenter's IP address and website URL.

The data in wp_comments is used to display comments on individual posts or pages, and to manage comments in admin interface. Additional comment details may be stored in wp_commentmeta table.

Columns

comment_ID: Unique identifier for each comment, used as primary key.

comment_post_ID: ID of the post the comment is associated with, used as a foreign key. it is the ID column from wp_posts table.

comment_author: Name of the commenter as provided in the comment form.

comment_author_email: Email address of the commenter as provided in the comment form.

comment_author_url: URL of the commenter's website as provided in the comment form.

comment_author_IP: IP address of the commenter, logged when the comment is submitted.

comment_date: Date and time the comment was posted in the WordPress site's timezone.

comment_date_gmt: GMT date and time the comment was posted.

comment_content: Content of the comment, as entered in the comment form.

comment_karma: Karma points associated with the comment, used for sorting and filtering comments.

comment_approved: Approval status of the comment, initially set to 0 for unapproved comments.

comment_agent: User agent string of the commenter's web browser, logged when the comment is submitted.

comment_type: Type of comment (e.g. pingback, trackback, etc.), automatically set by WordPress.

comment_parent: comment_ID of the parent comment if the comment is a reply.

user_id: ID of the user who posted the comment, if applicable. It is the ID column from wp_users table.

SQL Schema

CREATE TABLE `wp_comments` (
`comment_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`comment_post_ID` bigint(20) unsigned NOT NULL DEFAULT 0,
`comment_author` tinytext COLLATE utf8mb4_unicode_ci NOT NULL,
`comment_author_email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`comment_author_url` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`comment_author_IP` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`comment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment_content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`comment_karma` int(11) NOT NULL DEFAULT 0,
`comment_approved` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1',
`comment_agent` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`comment_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`comment_parent` bigint(20) unsigned NOT NULL DEFAULT 0,
`user_id` bigint(20) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`comment_ID`),
KEY `comment_post_ID` (`comment_post_ID`),
KEY `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`),
KEY `comment_date_gmt` (`comment_date_gmt`),
KEY `comment_parent` (`comment_parent`),
KEY `comment_author_email` (`comment_author_email`(10))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

By remaining on this website or using its content, you confirm that you have read and agree with the Terms of Use Agreement.

We are not liable for any damages resulting from using this website. Any information may be inaccurate or incomplete. See full Limitation of Liability.

Content may include affiliate links, which means we may earn commission if you buy on the linked website. See full Affiliate and Referral Disclosure.

We use cookies and similar technology to improve user experience and analyze traffic. See full Cookie Policy.

See also Privacy Policy on how we collect and handle user data.

© 2024 WPDir