FireDAC Components for WordPress

Build 20.0.7654

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 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 Description
Id [KEY] Integer False

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.

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
CategoriesFilter String

Accepts categories ids in CSV format. Filters only the posts that have at least one of the categories specified.

TagsFilter String

Accepts tags ids in CSV format. Filters only the posts that have at least one of the tags specified.

TaxonomyTerms String

Terms of the taxonomy that needs to be assigned to the post

Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 20.0.7654