Skip to content

Commit 2cc4951

Browse files
authored
Merge pull request #341 from newfold-labs/fix/redirect-after-yoast-installation
Prevent redirect after Yoast Premium installation
2 parents b7d36d9 + 8546ade commit 2cc4951

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

includes/Services/PluginService.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ public static function setup_plugin( $plugin ) {
133133
return true;
134134
}
135135

136+
if ( 'wordpress-seo-premium' === $slug ) {
137+
return self::enable_yoast_seo_premium();
138+
}
139+
136140
return false;
137141
}
138142

@@ -200,6 +204,20 @@ public static function enable_jetpack_forms_module() {
200204
}
201205

202206
// Return true if module is already active
203-
return class_exists( 'Jetpack' ) && \Jetpack::is_module_active( 'contact-form' );
207+
return class_exists( 'Jetpack' ) && \Jetpack::is_module_active( 'contact-form' ) && \Jetpack::is_module_active( 'blocks' );
208+
}
209+
210+
/**
211+
* Enable the Yoast SEO Premium module.
212+
*
213+
* @return boolean True if module was activated or was already active
214+
*/
215+
public static function enable_yoast_seo_premium() {
216+
if ( class_exists( 'WPSEO_Options' ) ) {
217+
// Disable redirect to Yoast onboarding.
218+
\WPSEO_Options::set( 'should_redirect_after_install', false );
219+
}
220+
221+
return true;
204222
}
205223
}

0 commit comments

Comments
 (0)