Schema Documentation

postBy

Deprecated in favor of using the single entry point for this type with ID and IDType fields. For example, instead of postBy( id: "" ), use post(id: "" idType: "")
Description

A post object

Response

Returns a Post

Arguments
NameDescription
id - ID Get the object by its global ID
postId - Int Get the post by its database ID
uri - String Get the post by its uri
slug - String Get the post by its slug (only available for non-hierarchical types)

Example

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