Queries Library
Queries LibraryDisplay which posts have a thumbnail, and which have not

Display which posts have a thumbnail, and which have not

This query retrieves all posts that have a thumbnail, and those that do not.

query GetPostsWithAndWithoutThumbnail {
  postsWithThumbnail: posts(
    filter: {
      metaQuery: {
        key: "_thumbnail_id",
        compareBy: {
          key: {
            operator: EXISTS
          }
        }
      }
    },
    pagination: { limit: -1 }
  ) {
    id
    title
    featuredImage {
      id
      src
    }
  }
 
  postsWithoutThumbnail: posts(
    filter: {
      metaQuery: {
        key: "_thumbnail_id",
        compareBy: {
          key: {
            operator: NOT_EXISTS
          }
        }
      }
    },
    pagination: { limit: -1 }
  ) {
    id
    title
  }
}