ODBC Driver for WordPress

Build 20.0.7587

Media

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

Table Specific Information

Select

The 本製品 uses the WordPress API to process supported filters. The 本製品 processes other filters client-side within the 本製品. 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 Media WHERE Id In ('1176','1175')
SELECT * FROM Media WHERE Id = '1176'
SELECT * FROM Media WHERE AuthorId In (1, 2)
SELECT * FROM Media WHERE MediaType = 'image'
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

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 False

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. One of: inherit, private, trash.

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) 2020 CData Software, Inc. - All rights reserved.
Build 20.0.7587