WPGraphQL

Description

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

Below are some links to help you get started with WPGraphQL

Build rich JavaScript applications with WordPress and GraphQL

WPGraphQL allows you to separate your CMS from your presentation layer. Content creators can use the CMS they know, while developers can use the frameworks and tools they love.

WPGraphQL works great with:

Query what you need. Get exactly that.

With GraphQL, the client makes declarative queries, asking for the exact data needed, and in exactly what was asked for is given in response, nothing more. This allows the client have control over their application, and allows the GraphQL server to perform more efficiently by only fetching the resources requested.

Fetch many resources in a single request.

GraphQL queries allow access to multiple root resources, and also smoothly follow references between connected resources. While typical a REST API would require round-trip requests to many endpoints, GraphQL APIs can get all the data your app needs in a single request. Apps using GraphQL can be quick even on slow mobile network connections.

Powerful Debugging Tools

WPGraphQL ships with GraphiQL in your WordPress dashboard, allowing you to browse your site’s GraphQL Schema and test Queries and Mutations.

Upgrading

It is recommended that anytime you want to update WPGraphQL that you get familiar with what’s changed in the release.

WPGraphQL publishes release notes on Github.

WPGraphQL has been following Semver practices for a few years. We will continue to follow Semver and let version numbers communicate meaning. The summary of Semver versioning is as follows:

  • MAJOR version when you make incompatible API changes,
  • MINOR version when you add functionality in a backwards compatible manner, and
  • PATCH version when you make backwards compatible bug fixes.

You can read more about the details of Semver at semver.org

Short Description

WPGraphQL adds a flexible and powerful GraphQL API to WordPress, enabling efficient querying and interaction with your site’s data.

Privacy Policy

WPGraphQL uses Appsero SDK to collect some telemetry data upon user’s confirmation. This helps us to troubleshoot problems faster & make product improvements.

Appsero SDK does not gather any data by default. The SDK only starts gathering basic telemetry data when a user allows it via the admin notice. We collect the data to ensure a great user experience for all our users.

Integrating Appsero SDK DOES NOT IMMEDIATELY start gathering data, without confirmation from users in any case.

Learn more about how Appsero collects and uses this data.

Captures d’écran

FAQ

Can I use WPGraphQL with xx JavaScript Framework?

WPGraphQL turns your WordPress site into a GraphQL API. Any client that can make http requests to the GraphQL endpoint can be used to interact with WPGraphQL.

Where do I get WPGraphQL Swag?

WPGraphQL Swag is available on the Gatsby Swag store.

What’s the relationship between Gatsby, WP Engine, and WPGraphQL?

WP Engine is the employer of Jason Bahl, the creator and maintainer of WPGraphQL. He was previously employed by Gatsby.

You can read more about this here.

Gatsby and WP Engine both believe that a strong GraphQL API for WordPress is a benefit for the web. Neither Gatsby or WP Engine are required to be used with WPGraphQL, however it’s important to acknowledge and understand what’s possible because of their investments into WPGraphQL and the future of headless WordPress!

Avis

29 mai 2023 1 reply
I operate a large blog that uses WordPress as a headless CMS with a Next.JS frontend, which is largely enabled by this plugin. Let me just say first that creating an entire alternative third-party data API is an ambitious undertaking and I appreciate all the work the authors have put into it. But as a developer I have to throw out a word of caution that this plugin often has major bugs that can have critical impact on your production website. For example after a recent minor update we discovered a bug where any URL with a special character in it started returning a 404, causing several of our pages to suddenly become unavailable to users and delisted from Google, and this went on for many months before we realized it. There have been many similar instances. My general approach is to lean more on WordPress’s REST API over time which is more reliable since it’s maintained by the WordPress team, and only use WPGraphQL when it’s necessary. Also recommend turning off auto-updates and test your website extremely thoroughly after any upgrade.
26 août 2022
One of the best plugins for WordPress. It’s right up there with ACF!
31 mai 2022
Great plugin, everyone should use it. The IDE is a valuable plus, and it can be used to learn GraphQL from scratch. From the developer’s point of view, the plugin is super easy to extend, thanks to the great documentation. Don’t forget to check the official YouTube channel. If you need extra support for custom post types and metas, I just released v1.0.70 of my plugin ACPT with full support to WPGraphQL. Thank you so much John!
25 avril 2022
Great tool for getting data from your WP into your SPA. I had some trouble with a conflicting plugin (Post Types Order) that caused unexpted results when paginating my posts but the support provided by both Jason Bahl and David Levine was absolutely top notch and I managed to resolve the issue within hours.
Lire les 47 avis

Contributeurs & développeurs

« WPGraphQL » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.

Contributeurs

Traduisez « WPGraphQL » dans votre langue.

Le développement vous intéresse ?

Parcourir le code, consulter le SVN dépôt, ou s’inscrire au journal de développement par RSS.

Journal

1.28.1

Chores / Bugfixes

  • #3189: fix: [regression] missing placeholder in $wpdb->prepare() call

1.28.0

Upgrade Notice

This release contains an internal refactor for how the Type Registry is generated which should lead to significant performance improvements for most users. While there is no known breaking changes, because this change impacts every user we highly recommend testing this release thoroughly on staging servers to ensure the changes don’t negatively impact your projects.

New Features

  • #3172: feat: only eagerlyLoadType on introspection requests.

Chores / Bugfixes

  • #3181: ci: replace docker-compose commands with docker compose
  • #3182: ci: test against WP 6.6
  • #3183: fix: improve performance of SQL query in the user loader

1.27.2

Chores / Bugfixes

  • #3167: fix: missing .svg causing admin_menu not to be registered

1.27.1

Chores / Bugfixes

  • #3066: fix: merge query arg arrays instead of overriding.
  • #3151: fix: update dev-deps and fix WPGraphQL::get_static_schema()
  • #3152: fix: handle regression when implementing interface with identical args.
  • #3153: chore(deps-dev): bump composer/composer from 2.7.6 to 2.7.7 in the composer group across 1 directory
  • #3155: chore(deps-dev): bump the npm_and_yarn group across 1 directory with 2 updates
  • #3160: chore: Update branding assets
  • #3162: fix: set_query_arg should not merge args

1.27.0

New Features

  • #3143: feat: Enhance tab state management with query arguments and localStorage fallback

Chores / Bugfixes

  • #3139: fix: $settings_fields param on « graphql_get_setting_section_field_value » filter not passing the correct type
  • #3137: fix: WPGraphQL Settings page fails to load when « graphiql_enabled » setting is « off »
  • #3133: build: clean up dist
  • #3146: test: add e2e test coverage for tabs in the settings page

1.26.0

New Features

  • #3125: refactor: improve query handling in AbstractConnectionResolver
    • new: graphql_connection_pre_get_query filter
    • new: AbstractConnectionResolver::is_valid_query_class()
    • new: AbstractConnectionResolver::get_query()
    • new: AbstractConnectionResolver::get_query_class()
    • new: AsbtractConnectionResolver::query_class()
    • new: AbstractConnectionResolver::$query_class
  • #3124: refactor: split AbstractConnectionResolver::get_args() and ::get_query_args() into ::prepare_*() methods
  • #3123: refactor: split AbstractConnectionResolver::get_ids() into ::prepare_ids()
  • #3121: refactor: split AbstractConnectionResolver::get_nodes() and get_edges() into prepare_*() methods
  • #3120: refactor: wrap AbstractConnectionResolver::is_valid_model() in ::get_is_valid_model()

Chores / Bugfixes

  • #3125: refactor: improve query handling in AbstractConnectionResolver
    • Implement PHPStan Generic Type
    • Update generic Exceptions to InvariantViolation
  • #3127: chore: update references to the WPGraphQL Slack Community to point to the new WPGraphQL Discord community instead.
  • #3122: chore: relocate AbstractConnectionResolver::is_valid_offset() with other abstract methods.

1.25.0

New Features

  • #3104: feat: add AbsractConnectionResolver::pre_should_execute(). Thanks @justlevine!

Chores / Bugfixes
#3104: refactor: AbstractConnectionResolver::should_execute() Thanks @justlevine!
#3112: fix: fixes a regression from v1.24.0 relating to field arguments defined on Interfaces not being properly merged onto Object Types that implement the interface. Thanks @kidunot89!
#3114: fix: node IDs not showing in the Query Analyzer / X-GraphQL-Keys when using DataLoader->load_many()
#3116: chore: Update WPGraphQLTestCase to v3. Thanks @kidunot89!

1.24.0

New Features

  • #3084: perf: refactor PluginConnectionResolver to only fetch plugins once. Thanks @justlevine!
  • #3088: refactor: improve loader handling in AbstractConnectionResolver. Thanks @justlevine!
  • #3087: feat: improve query amount handling in AbstractConnectionResolver. Thanks @justlevine!
  • #3086: refactor: add AbstractConnectionResolver::get_unfiltered_args() public getter. Thanks @justlevine!
  • #3085: refactor: add AbstractConnectionResolver::prepare_page_info()and only instantiate once. Thanks @justlevine!
  • #3083: refactor: deprecate camelCase methods in AbstractConnectionResolver for snake_case equivalents. Thanks @justlevine!

Chores / Bugfixes

  • #3095: chore: lint for superfluous whitespace. Thanks @justlevine!
  • #3100: fix: recursion issues with interfaces
  • #3082: chore: prepare ConnectionResolver classes for v2 backport

1.23.0

New Features

  • #3073: feat: expose hasPassword and password fields on Post objects. Thanks @justlevine!
  • #3091: feat: introduce actions and filters for GraphQL Admin Notices

Chores / Bugfixes

  • #3079: fix: GraphiQL IDE test failures
  • #3084: perf: refactor PluginConnectionResolver to only fetch plugins once. Thanks @justlevine!
  • #3092: ci: test against wp 6.5
  • #3093: ci: Update actions in GitHub workflows and cleanup. Thanks @justlevine!
  • #3093: chore: update Composer dev-deps and lint. Thanks @justlevine!

1.22.1

Chores / Bugfixes

  • #3067: fix: respect show avatar setting
  • #3063: fix: fixes a bug in cursor stability filters that could lead to empty order
  • #3070: test(3063): Adds test for #3063

1.22.0

New Features

  • #3044: feat: add graphql_pre_resolve_menu_item_connected_node filter
  • #3039: feat: add UniformResourceIdentifiable interface to Comment type
  • #3020: feat: introduce graphql_query_analyzer_get_headers filter

Chores / Bugfixes

  • #3062: ci: pin wp-browser to « <3.5 » to allow automated tests to run properly
  • #3057: fix: admin_enqueue_scripts callback should expect a possible null value passed to it
  • #3048: fix: isPostsPage on content type
  • #3043: fix: return empty when filtering menuItems by a location with no assigned items
  • #3045: fix: UsersConnectionSearchColumnEnum values should be prefixed with user_

1.21.0

New Features

  • #3035: feat: provide better error when field references a type that does not exist
  • #3027: feat: Add register_graphql_admin_notice API and intial use to inform users of the new WPGraphQL for ACF plugin

Chores / Bugfixes

  • #3038: chore(deps-dev): bump the composer group across 1 directories with 1 update. Thanks @dependabot!
  • #3033: fix: php deprecation error for dynamic properties on AppContext class
  • #3031: fix(graphiql): Allow GraphiQL to run even if a valid schema cannot be returned. Thanks @linucks!

1.20.0

New Features

  • #3013: feat: output GRAPHQL_DEBUG message if requested amount is larger than connection limit. Thanks @justlevine!
  • #3008: perf: Expose graphql_should_analyze_queries as setting. Thanks @justlevine!

Chores / Bugfixes

  • #3022: chore: add @justlevine to list of contributors! 🙌 🥳
  • #3011: chore: update composer dev-dependencies and use php-compatibility:develop branch to 8.0+ lints. Thanks @justlevine!
  • #3010: chore: implement stricter PHPDoc types. Thanks @justlevine!
  • #3009: chore: implement stricter PHPStan config and clean up unnecessary type-guards. Thanks @justlevine!
  • #3007: fix: call html_entity_decode() with explicit flags and decode single-quotes. Thanks @justlevine!
  • #3006: fix: replace deprecated AbstractConnectionResolver::setQueryArg() call with ::set_query_arg(). Thanks @justlevine!
  • #3004: docs: Update using-data-from-custom-database-tables.md
  • #2998: docs: Update build-your-first-wpgraphql-extension.md. Thanks @Jacob-Daniel!
  • #2997: docs: update wpgraphql-concepts.md. Thanks @Jacob-Daniel!
  • #2996: fix: Field id duplicates uri field description. Thanks @marcinkrzeminski!

View Full Changelog: https://github.com/wp-graphql/wp-graphql/blob/develop/CHANGELOG.md