diff --git a/includes/class-freemius.php b/includes/class-freemius.php index fd10929a..fa28f512 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -15777,6 +15777,10 @@ static function get_sites_blog_ids( $sites ) { function get_site_info( $site = null, $load_registration = false ) { $this->_logger->entrance(); + $fs_hook_snapshot = new FS_Hook_Snapshot(); + // Remove all filters from `switch_blog`. + $fs_hook_snapshot->remove( 'switch_blog' ); + $switched = false; $registration_date = null; @@ -15836,6 +15840,9 @@ function get_site_info( $site = null, $load_registration = false ) { restore_current_blog(); } + // Add the filters back to `switch_blog`. + $fs_hook_snapshot->restore( 'switch_blog' ); + return $info; } diff --git a/includes/class-fs-hook-snapshot.php b/includes/class-fs-hook-snapshot.php new file mode 100644 index 00000000..3fb26412 --- /dev/null +++ b/includes/class-fs-hook-snapshot.php @@ -0,0 +1,45 @@ +removed_actions[ $hook ] = $wp_filter[ $hook ]; + unset( $wp_filter[ $hook ] ); + } + } + + /** + * Restore previously removed actions for a given hook. + */ + public function restore( $hook ) { + global $wp_filter; + + if ( ! empty( $wp_filter ) && isset( $this->removed_actions[ $hook ] ) ) { + $wp_filter[ $hook ] = $this->removed_actions[ $hook ]; + unset( $this->removed_actions[ $hook ] ); + } + } + } \ No newline at end of file diff --git a/require.php b/require.php index 7fa226a1..5289f11c 100644 --- a/require.php +++ b/require.php @@ -58,4 +58,5 @@ require_once WP_FS__DIR_INCLUDES . '/class-fs-admin-notices.php'; require_once WP_FS__DIR_INCLUDES . '/class-freemius-abstract.php'; require_once WP_FS__DIR_INCLUDES . '/sdk/Exceptions/Exception.php'; + require_once WP_FS__DIR_INCLUDES . '/class-fs-hook-snapshot.php'; require_once WP_FS__DIR_INCLUDES . '/class-freemius.php'; diff --git a/start.php b/start.php index 9b02a1f2..a86d7ae8 100644 --- a/start.php +++ b/start.php @@ -15,7 +15,7 @@ * * @var string */ - $this_sdk_version = '2.12.1'; + $this_sdk_version = '2.12.1.1'; #region SDK Selection Logic --------------------------------------------------------------------