Schema Documentation
post
Description
An object of the post Type.
Response
Returns a Post
Arguments
Name | Description |
---|---|
id - ID! | The globally unique identifier of the object. |
idType - PostIdType | Type of unique identifier to fetch by. Default is Global ID |
asPreview - Boolean | Whether to return the Preview Node instead of the Published Node. When the ID of a Node is provided along with asPreview being set to true, the preview node with un-published changes will be returned instead of the published node. If no preview node exists or the requestor doesn't have proper capabilities to preview, no node will be returned. |
Example
Query
query post( $id: ID!, $idType: PostIdType,$asPreview: Boolean){ post( id: $id, idType: $idType, asPreview: $asPreview ){ author { ...NodeWithAuthorToUserConnectionEdgeFragment }authorDatabaseIdauthorIdcategories { ...PostToCategoryConnectionFragment }commentCountcommentStatuscomments { ...PostToCommentConnectionFragment }contentcontentType { ...ContentNodeToContentTypeConnectionEdgeFragment }contentTypeNamedatabaseIddatedateGmtdesiredSlugeditingLockedBy { ...ContentNodeToEditLockConnectionEdgeFragment }editorBlocks { ...PostEditorBlockFragment }enclosureenqueuedScripts { ...ContentNodeToEnqueuedScriptConnectionFragment }enqueuedStylesheets { ...ContentNodeToEnqueuedStylesheetConnectionFragment }excerptfeaturedImage { ...NodeWithFeaturedImageToMediaItemConnectionEdgeFragment }featuredImageDatabaseIdfeaturedImageIdguididisContentNodeisPreviewisRestrictedisRevisionisStickyisTermNodelastEditedBy { ...ContentNodeToEditLastConnectionEdgeFragment }linkmodifiedmodifiedGmtpingStatuspingedpostFormats { ...PostToPostFormatConnectionFragment }postIdpreview { ...PostToPreviewConnectionEdgeFragment }previewRevisionDatabaseIdpreviewRevisionIdrevisionOf { ...NodeWithRevisionsToContentNodeConnectionEdgeFragment }revisions { ...PostToRevisionConnectionFragment }seo { ...PostTypeSEOFragment }slugstatustags { ...PostToTagConnectionFragment }template { ...ContentTemplateFragment }terms { ...PostToTermNodeConnectionFragment }titletoPinguri }}
Variables
{"id":4,"idType":"DATABASE_ID","asPreview":false}
Response
{"data":{"post":{"author":NodeWithAuthorToUserConnectionEdge,"authorDatabaseId":123,"authorId":4,"categories":PostToCategoryConnection,"commentCount":987,"commentStatus":"xyz789","comments":PostToCommentConnection,"content":"abc123","contentType":ContentNodeToContentTypeConnectionEdge,"contentTypeName":"abc123","databaseId":987,"date":"abc123","dateGmt":"abc123","desiredSlug":"abc123","editingLockedBy":ContentNodeToEditLockConnectionEdge,"editorBlocks":[PostEditorBlock],"enclosure":"xyz789","enqueuedScripts":ContentNodeToEnqueuedScriptConnection,"enqueuedStylesheets":ContentNodeToEnqueuedStylesheetConnection,"excerpt":"xyz789","featuredImage":NodeWithFeaturedImageToMediaItemConnectionEdge,"featuredImageDatabaseId":987,"featuredImageId":4,"guid":"xyz789","id":4,"isContentNode":true,"isPreview":true,"isRestricted":true,"isRevision":true,"isSticky":true,"isTermNode":true,"lastEditedBy":ContentNodeToEditLastConnectionEdge,"link":"abc123","modified":"abc123","modifiedGmt":"abc123","pingStatus":"abc123","pinged":["xyz789"],"postFormats":PostToPostFormatConnection,"postId":123,"preview":PostToPreviewConnectionEdge,"previewRevisionDatabaseId":123,"previewRevisionId":4,"revisionOf":NodeWithRevisionsToContentNodeConnectionEdge,"revisions":PostToRevisionConnection,"seo":PostTypeSEO,"slug":"xyz789","status":"abc123","tags":PostToTagConnection,"template":ContentTemplate,"terms":PostToTermNodeConnection,"title":"abc123","toPing":["xyz789"],"uri":"xyz789"}}}