Add an admin notice that will display on the plugins page, network plugins page, WPGraphQL Settings page and WPGraphQL IDE page.

This is helpful for plugin authors and core WPGraphQL maintainers alert users about important information regarding WPGraphQL, such as upcoming breaking changes, important releases, etc.

register_graphql_admin_notice( string $slug, array $config );


  • $slug (string): A unique slug to identify the admin notice by
  • $config (array): Configuration for the notice
    • $message (string ) (required): The message to display in the admin notice. Sanitized by wp_kses_post before rendering.
    • $type (string): Determines the style of notice to display. Possible values are “error | warning | success | info”
    • $is_dismissable (boolean): Whether the notice should be dismissable or not. Dismissable notices will store the slug in user meta and any dismissed notices will no longer display for the user that dismissed the notice.
    • $conditions (function): Callback function to determine conditions for when the notice should be rendered. Return true to display the notice, false to keep it hidden.
      • Examples include rendering a notice if another plugin is not active, and hiding it if it is active. Or rendering a notice for users with specific capabilities and hiding for other users.


File: access-functions.php


Below are some examples of registering a graphql admin notice.

Register an Admin Notice to inform users about the new WPGraphQL for ACF plugin.

This example shows an admin notice registered to inform users about the new WPGraphQL for ACF plugin.

The notice is a dismissable “info” notice and will only be displayed if the following conditions are both met:

  • Advanced Custom Fields (free or pro) is active
  • WPGraphQL for ACF v2.0+ is _not_ active

For users that do not use ACF or already have the latest WPGraphQL for ACF active, the notice will not display. Further, any user that dismisses the notice will not see it again.

        'type'           => 'info',
        'message'        => __( 'You are using WPGraphQL and Advanced Custom Fields. Have you seen the new WPGraphQL for ACF?', 'wp-graphql' ),
        'is_dismissable' => true,
        'conditions'     => static function () {
            if ( ! class_exists( 'ACF' ) ) {
                return false;

            // Bail if new version of WPGraphQL for ACF is active.
            if ( class_exists( 'WPGraphQLAcf' ) ) {
                return false;

            return true;

Published by Jason Bahl

Jason is a Principal Software Engineer at WP Engine based in Denver, CO where he maintains WPGraphQL. When he's not writing code or evangelizing about GraphQL to the world, he enjoys escaping from escape rooms, playing soccer, board games and Fortnite.