These are examples of queries to fetch user data and log the user in.
A single user with his/her posts:
A list of 5 users, ordered by name:
A list of predefined users:
Filtering users by name:
Counting user results:
Fetching meta values:
Fetching roles and capabilities permalink
⚠️ Note: These fields are available when module "Schema for the Admin" is enabled. Read more in guide Querying 'unrestricted' fields.
capabilities for the users:
Logging the user in and out permalink
Logging the user in is required to execute mutations (create a post, add a comment, etc).
This query logs the user in (execute it to log in to the demo site, using a test account with role
To retrieve the logged-in user:
Log the user out: