Add Edit Link to All Post Types
The following snippet shows how to add the “Edit” link as a GraphQL field to all post types:
Register Connection to Attached Media
This code shows how to register a connection to attached media in WPGraphQL
Register object and field for custom list of users
The following code creates an object type called StuntPerformer
and creates a field on the RootQuery called stuntPerformers
that returns a custom list of users.
Tag to Content Node Connection
The following code registers a connection from Tags to ContentNodes. A field name called contentNodes will be added to the Tag type to make it easy to view all Posts that are tagged with that specific term.
List of Key Values
This is an example showing how to return a list of keys and values where the keys and values are both strings.
Popular Posts
The following code allows you to query for popular posts. It’s still up to you to determine the best way to store popular posts, but this example assumes a meta_key is involved. Beware though, meta queries can be expensive!