@@ -81,15 +81,22 @@ function graphql_seo_constants() : void {
81
81
if ( ! function_exists ( 'graphql_seo_dependencies_not_ready ' ) ) {
82
82
/**
83
83
* Checks if all the the required plugins are installed and activated.
84
+ *
85
+ * @return array<string, string> List of dependencies that are not ready.
84
86
*/
85
87
function graphql_seo_dependencies_not_ready () : array {
88
+ $ wpgraphql_version = '1.8.1 ' ;
89
+ $ rankmath_version = '1.0.90 ' ;
90
+
86
91
$ deps = [];
87
92
88
- if ( ! class_exists ( '\WPGraphQL ' ) ) {
89
- $ deps [] = 'WPGraphQL ' ;
93
+ // WPGraphQL Check.
94
+ if ( ! class_exists ( '\WPGraphQL ' ) || ( defined ( 'WPGRAPHQL_VERSION ' ) && version_compare ( WPGRAPHQL_VERSION , $ wpgraphql_version , '< ' ) ) ) { // @phpstan-ignore-line
95
+ $ deps ['WPGraphQL ' ] = $ wpgraphql_version ;
90
96
}
91
- if ( ! class_exists ( '\RankMath ' ) ) {
92
- $ deps [] = 'RankMath SEO ' ;
97
+
98
+ if ( ! class_exists ( '\RankMath ' ) || defined ( 'RANK_MATH_VERSION ' ) && version_compare ( RANK_MATH_VERSION , $ rankmath_version , '< ' ) ) {
99
+ $ deps ['RankMath SEO ' ] = $ rankmath_version ;
93
100
}
94
101
95
102
return $ deps ;
@@ -112,18 +119,19 @@ function graphql_seo_init() : void {
112
119
return ;
113
120
}
114
121
115
- foreach ( $ not_ready as $ dep ) {
122
+ foreach ( $ not_ready as $ dep => $ version ) {
116
123
add_action (
117
124
'admin_notices ' ,
118
- function () use ( $ dep ) {
125
+ function () use ( $ dep, $ version ) {
119
126
?>
120
127
<div class="error notice">
121
128
<p>
122
129
<?php
123
130
printf (
124
131
/* translators: dependency not ready error message */
125
- esc_html__ ( '%1$s must be active for WPGraphQL for Rank Math to work. ' , 'wp-graphql-rank-math ' ),
126
- esc_html ( $ dep )
132
+ esc_html__ ( '%1$s (v%2$s+) must be active for WPGraphQL for Rank Math to work. ' , 'wp-graphql-rank-math ' ),
133
+ esc_attr ( $ dep ),
134
+ esc_attr ( $ version ),
127
135
);
128
136
?>
129
137
</p>
0 commit comments