From 943fb47cba97d2803593d2c510f389db9ede0d5c Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 20 Mar 2018 15:43:30 +0100 Subject: [PATCH] Hotfix: Fatal error on WPSEO compatibility https://github.com/Yoast/wordpress-seo/pull/9285 --- includes/class-compat.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index 45f13dbb..03c885cc 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -331,13 +331,23 @@ public function get_plugin_capabilities( $caps = array() ) { // @since 1.7.4 Yoast SEO 5.5+ Load integration on front end. if ( ! is_admin() && VAA_API::exists_callable( array( 'WPSEO_Capability_Manager_Integration', 'register_hooks' ) ) ) { /** - * Registers the capabilities in the `members_get_capabilities` filter. - * @since Yoast SEO 5.8+ - * @link https://github.com/Yoast/wordpress-seo/pull/7937 + * Make sure WPSEO_Options::$backfill is instantiated. + * @link https://github.com/Yoast/wordpress-seo/pull/9285 + * @since Yoast SEO 7.1+ + * @since 1.7.6.1 */ - if ( VAA_API::exists_callable( array( 'WPSEO_Capability_Manager_Factory', 'get' ), 'debug' ) ) { - $wpseo = new WPSEO_Capability_Manager_Integration( WPSEO_Capability_Manager_Factory::get() ); - $wpseo->register_hooks(); + if ( VAA_API::exists_callable( array( 'WPSEO_Options', 'get_instance' ) ) ) { + WPSEO_Options::get_instance(); + + /** + * Registers the capabilities in the `members_get_capabilities` filter. + * @since Yoast SEO 5.8+ + * @link https://github.com/Yoast/wordpress-seo/pull/7937 + */ + if ( VAA_API::exists_callable( array( 'WPSEO_Capability_Manager_Factory', 'get' ), 'debug' ) ) { + $wpseo = new WPSEO_Capability_Manager_Integration( WPSEO_Capability_Manager_Factory::get() ); + $wpseo->register_hooks(); + } } }