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
    }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":"xyz789"}
Response
{"data":{"postBy":{"author":NodeWithAuthorToUserConnectionEdge,"authorDatabaseId":987,"authorId":4,"categories":PostToCategoryConnection,"commentCount":987,"commentStatus":"abc123","comments":PostToCommentConnection,"content":"abc123","contentType":ContentNodeToContentTypeConnectionEdge,"contentTypeName":"abc123","databaseId":987,"date":"xyz789","dateGmt":"xyz789","desiredSlug":"xyz789","editingLockedBy":ContentNodeToEditLockConnectionEdge,"enclosure":"xyz789","enqueuedScripts":ContentNodeToEnqueuedScriptConnection,"enqueuedStylesheets":ContentNodeToEnqueuedStylesheetConnection,"excerpt":"xyz789","featuredImage":NodeWithFeaturedImageToMediaItemConnectionEdge,"featuredImageDatabaseId":123,"featuredImageId":4,"guid":"abc123","id":4,"isContentNode":false,"isPreview":false,"isRestricted":false,"isRevision":false,"isSticky":true,"isTermNode":true,"lastEditedBy":ContentNodeToEditLastConnectionEdge,"link":"abc123","modified":"abc123","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":"xyz789","tags":PostToTagConnection,"template":ContentTemplate,"terms":PostToTermNodeConnection,"title":"xyz789","toPing":["xyz789"],"uri":"abc123"}}}