CData Python Connector for WordPress

Build 24.0.9060

Media

Create, update, delete, and query Media to attach in your posts.

Table Specific Information

Select

The connector uses the WordPress API to process supported filters. The connector processes other filters client-side within the connector. 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. Note : Status column only accepts the following values for select operation: inherit and private. For example, the following queries are processed server side.

SELECT * FROM Media WHERE Id IN ('1176', '1175')
SELECT * FROM Media WHERE Id = '1176'
SELECT * FROM Media WHERE AuthorId IN (1, 2)
SELECT * FROM Media WHERE MimeType = 'image/jpeg'
SELECT * FROM Media WHERE Status = 'Inherit'
SELECT * FROM Media WHERE Date < '2018-02-02T02:02:23'
SELECT * FROM Media WHERE Date > '2018-02-02T02:02:23'
SELECT * FROM Media ORDER BY Id
Also, ordering by Date, Modified, and AuthorId is handled by the WordPress API.

Insert and Update

Note : Status column only accepts the following values for insert and update operations: publish, future, draft, pending, and private. To insert a media you must specify the following column: FileLocation.

INSERT INTO Media (Title, FileLocation, Caption) VALUES ('MediaTitle', 'C:/myImages/image.png', 'This is an uploaded media.')

To update a media you must specify the following column: Id.

UPDATE Media SET Title = 'Updated Title' WHERE Id = '4'
Other fields that you can use on INSERT and UPDATE queries are: Date, DateGMT, Status, Title, AuthorId, CommentStatus, PingStatus, Caption, Description, PostId.

Delete

To delete a media you must specify the following column: Id.

DELETE FROM Media WHERE Id = '1234'

Columns

Name Type ReadOnly Description
Id [KEY] Integer True

Unique identifier for the object.

Title String False

The title for 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.

Type String True

Type of Post for the object.

AuthorId Integer False

The ID for the author of the object.

CommentStatus String False

Whether or not comments are open on the object.

PingStatus String False

Whether or not the object can be pinged.

Caption String False

The attachment caption.

Description String False

The attachment description.

MediaType String True

Attachment type.

MimeType String True

The attachment MIME type.

PostId Integer False

The ID for the associated post of the attachment.

SourceUrl String True

URL to the original attachment file.

Link String True

URL to the object.

Pseudo-Columns

Name Type Description
FileLocation String

The location of the file to be uploaded.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060