Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roborourke/wp-graphql-meta
Adds meta data registered via register_meta() to the GraphQL output.
https://github.com/roborourke/wp-graphql-meta
graphql wordpress
Last synced: about 1 month ago
JSON representation
Adds meta data registered via register_meta() to the GraphQL output.
- Host: GitHub
- URL: https://github.com/roborourke/wp-graphql-meta
- Owner: roborourke
- Created: 2017-05-20T14:39:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-03T06:11:09.000Z (over 3 years ago)
- Last Synced: 2024-08-02T05:15:14.573Z (4 months ago)
- Topics: graphql, wordpress
- Language: PHP
- Size: 2.93 KB
- Stars: 19
- Watchers: 5
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-wordpress-gatsby - WPGraphQL Meta - This FREE plugin from @robertorourke exposes meta registered via the WordPress register_meta API to WPGraphQL. (Plugins / WordPress)
README
WP GraphQL Meta
===============This plugin is an add-on for the awesome [WP GraphQL][wp-graphql]
It builds on top of both WP GraphQL and the REST API. Any
meta data you register using `register_meta()` will be available
to retrieve in your results. You get your data in the REST API and
GraphQL at the same time.## Installing
1. Make sure that [WP GraphQL][wp-graphql] is installed and activated first.
2. Upload this repo (or git clone) to your plugins folder and activate it.## Usage
Your theme or other plugins may use meta data to add custom functionality. That
data or functionality can be beneficial / required for a front end or
other app that consumes your API.```php
register_meta( 'post', 'custom-key', array(
'type' => 'string', // number, boolean, integer or a type from WPGraphQL\Types
'description' => 'My custom field',
'single' => true, // Whether to make this require a list or not.
'show_in_rest' => true, // Required to make this field public.
) );
```NOTE: If you use `WPGraphQL\Types` instance the built in REST API will
ignore the field.[wp-graphql]: https://github.com/wp-graphql/wp-graphql