diff --git a/src/aggregate-query.php b/src/aggregate-query.php index 5225a20..12588c9 100644 --- a/src/aggregate-query.php +++ b/src/aggregate-query.php @@ -6,6 +6,7 @@ */ namespace WPGraphQLFilterQuery; +use function WPGraphQL\FILTER_QUERY\filter_query_get_supported_post_types; /** * Main class. diff --git a/src/filter-query.php b/src/filter-query.php index 2ba86e4..5ba76ba 100644 --- a/src/filter-query.php +++ b/src/filter-query.php @@ -8,6 +8,7 @@ namespace WPGraphQLFilterQuery; use WPGraphQL\Data\Connection\AbstractConnectionResolver; +use function WPGraphQL\FILTER_QUERY\filter_query_get_supported_post_types; /** * Main class. diff --git a/tests/wp-graphql-filter-query.test.php b/tests/wp-graphql-filter-query.test.php index 1f99ca3..c8b1e91 100644 --- a/tests/wp-graphql-filter-query.test.php +++ b/tests/wp-graphql-filter-query.test.php @@ -1,5 +1,7 @@ add_hooks(); +( new AggregateQuery() )->add_hooks(); + /** * Get the supported post types. * @@ -68,6 +88,59 @@ function filter_query_get_supported_post_types(): array { return $type_objects; } +/** + * Show admin notice to admins if this plugin is active but WPGraphQL not. + * + * @return bool + */ +function show_admin_notice() { -( new FilterQuery() )->add_hooks(); -( new AggregateQuery() )->add_hooks(); + /** + * For users with lower capabilities, don't show the notice. + */ + if ( ! current_user_can( 'manage_options' ) ) { + return false; + } + + add_action( + 'admin_notices', + function() { + ?> +
+ +
+