These are examples of queries to fetch and modify post data.
A single post, with author and tags:
A list of 5 posts with their comments:
A list of predefined posts:
Filtering posts:
Counting post results:
Paginating posts:
Posts with tags:
Posts with categories:
Fetching meta values:
Fields post
, posts
and postCount
only retrieve posts with status "publish"
.
To fetch posts from the logged-in user, with any status ("publish"
, "pending"
, "draft"
or "trash"
), use these fields:
myPost
myPosts
myPostCount
Only logged-in users can create posts.
Only users with the corresponding capabilities can edit posts.
This query uses nested mutations to update the post: