josephfusco / wpgraphiql-query-injector
Inject a custom query and variables into the WPGraphiQL editor
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:wordpress-plugin
README
Overview
WPGraphiQL Query Injector is a WordPress plugin designed to inject custom GraphQL queries and variables into your WPGraphiQL editor. The plugin aims to provide a straightforward way to populate the WPGraphiQL editor within a WordPress Playground environment.
Usage
Once the plugin is activated, it will automatically populate the WPGraphiQL editor with predefined queries and variables. You can modify these by applying WordPress filters.
Filters
wpgraphiql_query
Filter the GraphiQL Query input.
add_filter( 'wpgraphiql_query', function() { return <<<GRAPHQL query GeneralSettings { allSettings { siteTitle: generalSettingsTitle sideDescription: generalSettingsDescription } } GRAPHQL });
wpgraphiql_variables
Filter the GraphiQL Variables input.
add_filter( 'wpgraphiql_variables', function() { return <<<JSON { "id": 716 } JSON; });
wpgraphiql_use_public_fetcher
Filter auth vs public requests.
add_filter( 'wpgraphiql_use_public_fetcher', function() { return 'true'; });