Schema Documentation
MediaItem
Description
The mediaItem type
Fields
Field Name | Description |
---|---|
altText - String | Alternative text to display when resource is not displayed |
ancestors - HierarchicalContentNodeToContentNodeAncestorsConnection | Returns ancestors of the node. Default ordered as lowest (closest to the child) to highest (closest to the root). |
Arguments
| |
author - NodeWithAuthorToUserConnectionEdge | Connection between the NodeWithAuthor type and the User type |
authorDatabaseId - Int | The database identifier of the author of the node |
authorId - ID | The globally unique identifier of the author of the node |
caption - String | The caption for the resource |
Arguments
| |
children - HierarchicalContentNodeToContentNodeChildrenConnection | Connection between the HierarchicalContentNode type and the ContentNode type |
Arguments
| |
commentCount - Int | The number of comments. Even though WPGraphQL denotes this field as an integer, in WordPress this field should be saved as a numeric string for compatibility. |
commentStatus - String | Whether the comments are open or closed for this particular post. |
comments - MediaItemToCommentConnection | Connection between the MediaItem type and the Comment type |
Arguments
| |
contentType - ContentNodeToContentTypeConnectionEdge | Connection between the ContentNode type and the ContentType type |
contentTypeName - String! | The name of the Content Type the node belongs to |
databaseId - Int! | The unique identifier stored in the database |
date - String | Post publishing date. |
dateGmt - String | The publishing date set in GMT. |
description - String | Description of the image (stored as post_content) |
Arguments
| |
desiredSlug - String | The desired slug of the post |
editingLockedBy - ContentNodeToEditLockConnectionEdge | If a user has edited the node within the past 15 seconds, this will return the user that last edited. Null if the edit lock doesn't exist or is greater than 15 seconds |
enclosure - String | The RSS enclosure for the object |
enqueuedScripts - ContentNodeToEnqueuedScriptConnection | Connection between the ContentNode type and the EnqueuedScript type |
Arguments
| |
enqueuedStylesheets - ContentNodeToEnqueuedStylesheetConnection | Connection between the ContentNode type and the EnqueuedStylesheet type |
Arguments
| |
fileSize - Int | The filesize in bytes of the resource |
Arguments
| |
guid - String | The global unique identifier for this post. This currently matches the value stored in WP_Post->guid and the guid column in the "post_objects" database table. |
id - ID! | The globally unique identifier of the attachment object. |
isContentNode - Boolean! | Whether the node is a Content Node |
isPreview - Boolean | Whether the object is a node in the preview state |
isRestricted - Boolean | Whether the object is restricted from the current viewer |
isTermNode - Boolean! | Whether the node is a Term |
lastEditedBy - ContentNodeToEditLastConnectionEdge | The user that most recently edited the node |
link - String | The permalink of the post |
mediaDetails - MediaDetails | Details about the mediaItem |
mediaItemId - Int! | The id field matches the WP_Post->ID field. Deprecated in favor of the databaseId field |
mediaItemUrl - String | Url of the mediaItem |
mediaType - String | Type of resource |
mimeType - String | The mime type of the mediaItem |
modified - String | The local modified time for a post. If a post was recently updated the modified field will change to match the corresponding time. |
modifiedGmt - String | The GMT modified time for a post. If a post was recently updated the modified field will change to match the corresponding time in GMT. |
parent - HierarchicalContentNodeToParentContentNodeConnectionEdge | The parent of the node. The parent object can be of various types |
parentDatabaseId - Int | Database id of the parent node |
parentId - ID | The globally unique identifier of the parent node. |
previewRevisionDatabaseId - Int | The database id of the preview node |
previewRevisionId - ID | Whether the object is a node in the preview state |
seo - PostTypeSEO | The Yoast SEO data of the ContentNode |
sizes - String | The sizes attribute value for an image. |
Arguments
| |
slug - String | The uri slug for the post. This is equivalent to the WP_Post->post_name field and the post_name column in the database for the "post_objects" table. |
sourceUrl - String | Url of the mediaItem |
Arguments
| |
srcSet - String | The srcset attribute specifies the URL of the image to use in different situations. It is a comma separated string of urls and their widths. |
Arguments
| |
status - String | The current status of the object |
template - ContentTemplate | The template assigned to a node of content |
title - String | The title of the post. This is currently just the raw title. An amendment to support rendered title needs to be made. |
Arguments
| |
uri - String | The unique resource identifier path |
Example
{"altText":"xyz789","ancestors":HierarchicalContentNodeToContentNodeAncestorsConnection,"author":NodeWithAuthorToUserConnectionEdge,"authorDatabaseId":123,"authorId":"4","caption":"abc123","children":HierarchicalContentNodeToContentNodeChildrenConnection,"commentCount":987,"commentStatus":"abc123","comments":MediaItemToCommentConnection,"contentType":ContentNodeToContentTypeConnectionEdge,"contentTypeName":"xyz789","databaseId":123,"date":"abc123","dateGmt":"xyz789","description":"xyz789","desiredSlug":"xyz789","editingLockedBy":ContentNodeToEditLockConnectionEdge,"enclosure":"abc123","enqueuedScripts":ContentNodeToEnqueuedScriptConnection,"enqueuedStylesheets":ContentNodeToEnqueuedStylesheetConnection,"fileSize":987,"guid":"abc123","id":"4","isContentNode":true,"isPreview":true,"isRestricted":false,"isTermNode":false,"lastEditedBy":ContentNodeToEditLastConnectionEdge,"link":"xyz789","mediaDetails":MediaDetails,"mediaItemId":987,"mediaItemUrl":"xyz789","mediaType":"abc123","mimeType":"xyz789","modified":"abc123","modifiedGmt":"abc123","parent":HierarchicalContentNodeToParentContentNodeConnectionEdge,"parentDatabaseId":123,"parentId":"4","previewRevisionDatabaseId":123,"previewRevisionId":"4","seo":PostTypeSEO,"sizes":"abc123","slug":"abc123","sourceUrl":"xyz789","srcSet":"abc123","status":"xyz789","template":ContentTemplate,"title":"xyz789","uri":"abc123"}