Comments
Returns comments from WordPress posts, including author details, content, and status information.
Table Specific Information
Select
The driver uses the WordPress API to process supported filters. The driver processes other filters client-side within the driver. To retrieve and filter the values for the AuthorEmail column, use Context='edit' in the WHERE clause.
For example, the following queries are processed server side.
SELECT * FROM Comments WHERE Id = 61
SELECT * FROM Comments WHERE Id IN (61, 45)
SELECT * FROM Comments WHERE AuthorEmail = '[email protected]' AND Status = 'approve' AND Type = 'comment' AND PostId = '1' AND Context='edit'
SELECT * FROM Comments WHERE Author IN ('1', '2')
SELECT * FROM Comments WHERE Date > '2018-02-02T02:02:23'
SELECT * FROM Comments WHERE Date < '2018-02-02T02:02:23'
SELECT * FROM Comments ORDER BY Date DESC
Also, ordering by Id, DateGMT, Type, Parent, is handled by the WordPress API.
Insert
To insert comments you must specify the following columns: PostId, Content.
INSERT INTO Comments (PostId, Content) VALUES ('1', 'This is a comment in the post with id 1.')
Update
To update a comment you must specify the following column: IdUPDATE Comments SET Content = 'Updated content' WHERE Id = '1234'
Other fields that you can use on INSERT / UPDATE queries are:
Author, AuthorEmail, AuthorIp, AuthorName, AuthorUrl, Content, Date, DateGMT, Parent, PostId, Status.
Delete
To delete a Comment you must specify the following column: Id.
DELETE FROM Comments WHERE Id = '1234'
Columns
| Name | Type | ReadOnly | References | Description |
| Id [KEY] | Integer | True |
The unique identifier for the comment object in WordPress. | |
| Author | Integer | False |
Specifies the name of the author who submitted the comment on the WordPress post. | |
| AuthorEmail | String | False |
The author's email address for the object. To filter values for this column. | |
| AuthorIp | String | False |
The IP address associated with the comment's author, identifying the source location from which the comment was submitted to WordPress. | |
| AuthorName | String | False |
The display name of the user who authored the comment in WordPress. | |
| AuthorUrl | String | False |
Specifies the website URL submitted by the author when posting the comment. | |
| Date | Datetime | False |
The date and time when the comment was posted in WordPress. | |
| DateGMT | Datetime | False |
The date the object was published as Greenwich Mean Time (GMT). | |
| Status | String | False |
The approval status of the comment, such as approved, pending, or spam. The allowed values are hold, approved, spam, trash. | |
| Type | String | True |
Specifies the type of comment, such as a standard comment, trackback, or pingback. | |
| Parent | Integer | False |
Specifies the identifier of the parent comment when this comment is a reply. A value of 0 indicates no parent. | |
| Content | String | False |
The text content of the comment submitted by the author. | |
| PostId | Integer | False |
The unique identifier of the post or page associated with the comment. | |
| Link | String | True |
The URL linking directly to the comment on the associated WordPress post. |
Pseudo-Columns
Pseudo-column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the data returned by the operation.
| Name | Type | Description |
| Context | String |
The context or area of WordPress where the comment was posted. The allowed values are view, edit, embed. |