Media
Create, update, delete, and query Media to attach in your posts.
Table Specific Information
Select
The add-in uses the WordPress API to process supported filters. The add-in processes other filters client-side within the add-in.
Note: The 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.
Update
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 | References | Description |
| Id [KEY] | Integer | True |
The unique identifier of the media item in WordPress. | |
| Title | String | False |
The title assigned to the media item, such as the file name or a descriptive label. | |
| Date | Datetime | False |
The date and time when the media item was uploaded, recorded in the site's local timezone. | |
| DateGMT | Datetime | False |
The upload date and time of the media item recorded in Greenwich Mean Time (GMT). | |
| Modified | Datetime | True |
The date and time when the media item was last modified in the site's local timezone. | |
| ModifiedGMT | Datetime | True |
The date and time when the media item was last modified in Greenwich Mean Time (GMT). | |
| Status | String | False |
The publication status of the media item, such as inherit or private. | |
| Type | String | True |
Specifies the type of WordPress post associated with the media item, typically 'attachment'. | |
| AuthorId | Integer | False |
The unique identifier of the user who uploaded or owns the media item. | |
| CommentStatus | String | False |
Indicates whether comments are allowed on the media item. | |
| PingStatus | String | False |
Indicates whether the media item can receive pingbacks or trackbacks. | |
| Caption | String | False |
A short explanatory caption or description displayed with the media item. | |
| Description | String | False |
The full description or additional details provided for the media item. | |
| MediaType | String | True |
Specifies the general type of the media item, such as image, video, or audio. | |
| MimeType | String | True |
The Multipurpose Internet Mail Extensions (MIME) type of the media file, such as image/jpeg or video/mp4. | |
| PostId | Integer | False |
The ID of the post or page the media item is attached to, if applicable. | |
| SourceUrl | String | True |
The direct URL to the original media file stored in WordPress. | |
| Link | String | True |
The permalink URL for viewing the media item in WordPress. |
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 |
| FileLocation | String |
Specifies the local file path or source location of the media file to upload. |