Posts
Create, update, delete, and query Wordpress Posts.
Table Specific Information
SELECT
The server uses the WordPress API to process some of the filters. The server processes other filters client-side within the server.
For example, the following queries are processed server side.
SELECT * FROM Posts WHERE Id = 1
SELECT * FROM Posts WHERE Status = 'publish' AND Sticky = 'true'
SELECT * FROM Posts WHERE Id IN (1, 21)
SELECT * FROM Posts WHERE Author IN (1, 2)
SELECT * FROM Posts WHERE Date < '2018-02-02T02:02:23'
SELECT * FROM Posts WHERE Date > '2018-02-02T02:02:23'
SELECT * FROM Posts ORDER BY Title
Also, ordering by Id, Author, Date, Modified, is handled by the WordPress API.
Insert and Update
To insert a post you must specify one of the following columns: Title, Content, and Excerpt.
INSERT INTO Posts (Title, status) VALUES ('New post', 'publish')
To create a post with custom taxonomy, you must specify the TaxonomyTerms(name:terms) in the below format.
INSERT INTO Posts (Title, Content, Status, TaxonomyTerms) VALUES ('The story of Dr Strange', 'This is the content', 'publish', 'books:2,5')"
To update a post you must specify the following column: Id.
UPDATE Posts SET Content = 'Updated content' WHERE Id = '12345'
To update the post with custom taxonomy, you must specify the TaxonomyTerms(name:terms) in the below format.
UPDATE Posts SET taxonomyterms = 'books:2,5' WHERE Id = '10'"
Other fields that you can use on INSERT and UPDATE queries are the following:
Date, DateGMT, Status, Excerpt, Title, Content, Author, MediaId, CommentStatus, PingStatus, Sticky, Categories, Tags and TaxonomyTerms.
Delete
To delete a post you must specify the following column: Id.
DELETE FROM Posts WHERE Id = '12345'
Columns
| Name | Type | ReadOnly | References | Description |
| Id [KEY] | Integer | True |
The unique identifier of the post in WordPress. | |
| Title | String | False |
The title of the WordPress post, displayed in listings, navigation, and page headers. | |
| CommentStatus | String | False |
Indicates whether comments are enabled for the post, allowing visitors to leave feedback. | |
| Categories | String | False |
The list of categories assigned to the post, provided as a comma-separated string. | |
| Tags | String | False |
The list of tags assigned to the post, provided as a comma-separated string for organizing content. | |
| Author | Integer | False |
The unique identifier of the user who authored or published the post. | |
| Date | Datetime | False |
The date and time when the post was published, recorded in the site's local timezone. | |
| DateGMT | Datetime | False |
The date and time when the post was published, recorded in Greenwich Mean Time (GMT). | |
| Modified | Datetime | True |
The date and time when the post was last updated, recorded in the site's local timezone. | |
| ModifiedGMT | Datetime | True |
The date and time when the post was last updated, recorded in GMT. | |
| Status | String | False |
Indicates the current publication state of the post, such as publish, future, draft, pending, or private. The allowed values are publish, future, draft, pending, private. | |
| Type | String | True |
Specifies the type of post, such as post, page, or a registered custom post type. | |
| Content | String | False |
The main body content of the WordPress post, including formatted text, media, or HTML. | |
| Excerpt | String | False |
A short summary or preview of the post content, often displayed in feeds or post listings. | |
| PingStatus | String | False |
Specifies whether pingbacks and trackbacks are enabled for the post. | |
| Format | String | False |
Defines the visual format of the post, such as standard, aside, gallery, or link. | |
| Sticky | Boolean | False |
Indicates whether the post is marked as sticky, keeping it pinned to the top of the site's front page. | |
| Link | String | True |
The permalink URL for viewing the post on the WordPress site. | |
| FeaturedMediaId | Integer | False |
The unique identifier of the media item, such as an image, set as the featured image for the 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 |
| TaxonomyTerms | String |
Specifies the taxonomy terms, such as categories or tags, to be assigned to the post. |
| Context | String |
Defines the request scope, which determines which fields are included in the response, such as view or edit. The allowed values are view, edit, embed. |