Adds meta data registered via register_meta() to the GraphQL output.

Overview

WP GraphQL Meta

This plugin is an add-on for the awesome 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 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.

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.

Comments
  • Provide graphql_meta_field_name filter for custom meta names in GraphQL.

    Provide graphql_meta_field_name filter for custom meta names in GraphQL.

    This allows you to customize the name of the field in GraphQL instead of using the meta key by default. Minor, but allows to use snake_case in WP but camelCase in GraphQL.

    opened by chriszarate 1
  • Use graphql_single_name when available as the filter target.

    Use graphql_single_name when available as the filter target.

    Previously if you took advantage of using graphql_single_name when registering custom post types or taxonomies, you lost the ability to use this plugin since it continued to use the default object name. The follows graphql_single_name so that the correct graphql filter is used.

    opened by chriszarate 1
  • Does not work for custom post types?

    Does not work for custom post types?

    Hi,

    Firstly, great little plugin.

    I was having trouble adding a meta field for a custom post type. After some debugging, I found that the plugin is being loaded before the custom post types are.

    Issue The plugin instantiates on graphql_init, which I think is the locigal place to hook in. However, wp-graphql instantiates on after_setup_theme, which is before custom post types are added on the init hook. https://codex.wordpress.org/Plugin_API/Action_Reference

    So even though you register your meta field through the register_meta function, it won't get added because the post type hasn't been added yet.

    Solution Moving the plugin to load on do_graphql_request instead of graphql_init seems to do the trick. I'm unaware of any side effects by doing this, if there are any.

    I would sugget to either move the plugin to load on do_graphql_request. If this is not a good solution please let me know and I'll prepare a PR for wp-graphql with solution for a second hook that fires on init.

    Regards, Rasmus

    opened by rasmustaarnby 1
  • Allow for attachment post meta to be exposed via post type mapping.

    Allow for attachment post meta to be exposed via post type mapping.

    WPGraphQL uses mediaItem as the type name for attachments, which means that meta registered against the attachment post type isn't respected. This adds a mapping array so that post types can be mapped to GraphQL types.

    opened by chriszarate 1
  • Not loading shema in IDE

    Not loading shema in IDE

    Once I activate the plugin, the wp_graphql IDE won't load its schema.

    /index.php?gql:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    invariant.mjs:6 Uncaught (in promise) Error: Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: { status: 500 }
        at r (invariant.mjs:6)
        at r (buildClientSchema.mjs:27)
        at App.js:181
    

    WordPress 5.6 WP GraphQL 1.0.3

    opened by martin-braun 4
Owner
Robert O'Rourke
Principal Product Engineering bod. Likes good typography and bots but hasn't yet combined the two.
Robert O'Rourke
WPGraphQL for Meta Box

WPGraphQL-MetaBox: WPGraphQL provider for Meta Box Quick Install Download and install like any WordPress plugin. Documentation The WPGraphQL documenta

null 25 Aug 8, 2022
:rocket: GraphQL API for WordPress

WPGraphQL WPGraphQL is a free, open-source WordPress plugin that provides an extendable GraphQL schema and API for any WordPress site. Below are some

WPGraphQL 3.4k Jan 5, 2023
Makes WP GraphQL's authetication "just work". It does this by customizing the CORS headers.

WP GraphQL CORS The primary purpose of this plugin is to make the WP GraphQL plugin authentication "just work". It does this by allowing you set the C

Funkhaus 86 Jan 5, 2023
Query gutenberg blocks with wp-graphql

WPGraphQL Gutenberg Query gutenberg blocks through wp-graphql Usage Docs Join our community through WpGraphQL Slack Install Requires PHP 7.0+ Requires

null 270 Jan 3, 2023
Enable query locking for WPGraphQL by implementing persisted GraphQL queries.

?? WP GraphQL Lock This plugin enables query locking for WPGraphQL by implementing persisted GraphQL queries. Persisted GraphQL queries allow a GraphQ

Valu Digital 21 Oct 9, 2022
Offset pagination for WP GraphQL

WP GraphQL Offset Pagination This is an extension for the WPGraphQL plugin for WordPress. It adds basic offset pagination as opposed to the standard C

Daryll Doyle 13 Sep 19, 2022
Bringing the power of GraphQL to BuddyPress.

WPGraphQL BuddyPress Bringing the power of GraphQL to BuddyPress. Docs (soon) • Join Slack System Requirements PHP >= 7.1 WP >= 4.9 WPGraphQL >= lates

WPGraphQL 31 Jan 2, 2023
GraphQL API for interacting with Gravity Forms.

?? ?? WPGraphQL for Gravity Forms A WordPress plugin that provides a GraphQL API for interacting with Gravity Forms. Join the WPGraphQL community on S

Harness Software 135 Jan 2, 2023
A WordPress plugin that provides a programmatic interface to register data providers and display (inject) the data in templates asynchronously

A WordPress plugin that provides a programmatic interface to register data providers and display (inject) the data in templates asynchronously

Martins Luters 3 Jun 26, 2022
WPGraphQL Extension: Adds "meta_query" support to postObject connection queries using WP_Query

WPGraphQL Meta Query This plugin adds Meta_Query support to the WP GraphQL Plugin for postObject query args. Why is this an extension and not part of

WPGraphQL 42 Nov 10, 2022
Adds `tax_query` support to postObject connection queries using WP_Query

WPGraphQL Tax Query This plugin adds Tax_Query support to the WP GraphQL Plugin for postObject query args (WP_Query). Pre-req's Using this plugin requ

WPGraphQL 39 Dec 2, 2022
Adds Settings to the Custom Post Type UI plugin to show Post Types in WPGraphQL

DEPRECATION NOTICE ?? Custom Post Type UI v1.9.0 introduced formal support for WPGraphQL!!! ?? With that, this plugin is being deprecated and will no

WPGraphQL 77 Aug 3, 2022
Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.

Laravel Blog Have you worked with Wordpress? Developers call this package wordpress-like laravel blog. Contact us for any customization: contact@binsh

Binshops 279 Dec 28, 2022
Simple Wordpress plugin that adds social share buttons

Super Fast Social Share Simple Wordpress plugin that adds social share buttons to Wordpress posts. ?? Screenshots You can either load the default css

Matthew Kiggen 2 Nov 8, 2021
Adds a beautiful WhatsApp Sticky Button on the WordPress frontend

Adds a beautiful WhatsApp Sticky Button on the WordPress frontend

Rasoul Mousavian 8 Dec 22, 2022
Adds a dashboard widget that allows admins to quickly open the edit screen for any WordPress post type- including orders, products, and subscriptions.

Quick Open Dashboard Widget Requires PHP: 7.0 WP requires at least: 5.7 WP tested up to: 5.7 WC requires at least: 5.6.0 WC tested up to: 5.8.0 Stable

Universal Yums 4 Nov 11, 2021
Adds WordPress toolbar menu that allows users to switch theme for themselves.

Toolbar Theme Switcher — for WordPress Plugin provides toolbar (admin bar) menu to quickly switch between available themes. Theme choice is individual

Andrey Savchenko 20 Jul 23, 2021
Send emails via mutation using WpGraphQl

WPGraphQL Send Email Plugin One of the simple things about a traditional WordPress sites is sending emails, this plugin makes it easy to do this via a

Ashley Hitchcock 18 Aug 21, 2022
Wordpress integrated with Laravel via Composer. Together, but independents.

Wordpress integrated with Laravel via Composer. Atention! The branch master is no longer manteined. Now I'm working on branch light. Not booting Larav

Bruno Barros 20 Nov 29, 2022