Schema Documentation

post

Description

An object of the post Type.

Response

Returns a Post

Arguments
NameDescription
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 node as a preview instance

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":"abc123","comments":PostToCommentConnection,"content":"abc123","contentType":ContentNodeToContentTypeConnectionEdge,"contentTypeName":"abc123","databaseId":123,"date":"abc123","dateGmt":"abc123","desiredSlug":"abc123","editingLockedBy":ContentNodeToEditLockConnectionEdge,"editorBlocks":[PostEditorBlock],"enclosure":"xyz789","enqueuedScripts":ContentNodeToEnqueuedScriptConnection,"enqueuedStylesheets":ContentNodeToEnqueuedStylesheetConnection,"excerpt":"abc123","featuredImage":NodeWithFeaturedImageToMediaItemConnectionEdge,"featuredImageDatabaseId":123,"featuredImageId":"4","guid":"abc123","id":"4","isContentNode":true,"isPreview":true,"isRestricted":true,"isRevision":false,"isSticky":false,"isTermNode":false,"lastEditedBy":ContentNodeToEditLastConnectionEdge,"link":"abc123","modified":"xyz789","modifiedGmt":"xyz789","pingStatus":"xyz789","pinged":["xyz789"],"postFormats":PostToPostFormatConnection,"postId":987,"preview":PostToPreviewConnectionEdge,"previewRevisionDatabaseId":987,"previewRevisionId":4,"revisionOf":NodeWithRevisionsToContentNodeConnectionEdge,"revisions":PostToRevisionConnection,"seo":PostTypeSEO,"slug":"xyz789","status":"abc123","tags":PostToTagConnection,"template":ContentTemplate,"terms":PostToTermNodeConnection,"title":"xyz789","toPing":["abc123"],"uri":"xyz789"}}}
©  2021-2023WPGraphQL WooCommerce.All rights reserved.