Skip to content

feat: Automate admin notice when it is required by an extension #3204

@josephfusco

Description

@josephfusco

As a WPGraphQL extension author, I would like to have my WPGraphQL extension be suggested if the plugin that it depends on is active. This behavior would be similar to how WPGraphQL for ACF is suggested when both WPGraphQL and ACF are active.

register_graphql_admin_notice(
'wpgraphql-acf-announcement',
[
'type' => 'info',
'message' => __( 'You are using WPGraphQL and Advanced Custom Fields. Have you seen the new <a href="https://acf.wpgraphql.com/" target="_blank" rel="nofollow">WPGraphQL for ACF</a>?', '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;
},
]
);

CleanShot 2024-09-04 at 14 14 51@2x

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementImprovements to existing functionality

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions