Posts
Create, update, delete, and query Wordpress Posts.
Table Specific Information
SELECT
The component uses the WordPress API to process some of the filters. The component processes other filters client-side within the component. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will cause inconsistent data.
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 TitleAlso, 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 | Description |
Id [KEY] | Integer | True |
Unique identifier for the object. |
Title | String | False |
The title for the object. |
CommentStatus | String | False |
Whether or not comments are open on the object. |
Categories | String | False |
Categories assigned to the post in comma separated values |
Tags | String | False |
Tags assigned to the post in comma separated values. |
Author | Integer | False |
The ID for the author of the object. |
Date | Datetime | False |
The date the object was published, in the site's timezone. |
DateGMT | Datetime | False |
The date the object was published, as GMT. |
Modified | Datetime | True |
The date the object was last modified, in the site's timezone. |
ModifiedGMT | Datetime | True |
The date the object was last modified, as GMT. |
Status | String | False |
A named status for the object. One of: publish, future, draft, pending, private. The allowed values are publish, future, draft, pending, private. |
Type | String | True |
Type of Post for the object. |
Content | String | False |
The content for the object. |
Excerpt | String | False |
The excerpt for the object. |
PingStatus | String | False |
Whether or not the object can be pinged. |
Format | String | False |
The format for the object. |
Sticky | Boolean | False |
Whether or not the object should be treated as sticky. |
Url | String | True |
URL to the object. |
MediaId | Integer | False |
The ID of the featured media for the object. |
Pseudo-Columns
Name | Type | Description |
TaxonomyTerms | String |
Terms of the taxonomy that needs to be assigned to the post |
Context | String |
Scope under which the request is made; determines fields present in response. The allowed values are view, edit, embed. |