•  An error of type E_ERROR was caused in line 124 of the file /home/www/wordpress/wp-content/plugins/full-site-editing/help-center/class-help-center.php. Error message: Uncaught Error: Class "Jetpack_Options" not found in /home/www/wordpress/wp-content/plugins/full-site-editing/help-center/class-help-center.php:124
    Stack trace:
    #0 /home/www/wordpress/wp-content/plugins/full-site-editing/help-center/class-help-center.php(113): A8C\FSE\Help_Center->get_current_site()
    #1 /home/www/wordpress/wp-content/plugins/full-site-editing/help-center/class-help-center.php(240): A8C\FSE\Help_Center->enqueue_script()
    #2 /home/www/wordpress/wp-includes/class-wp-hook.php(308): A8C\FSE\Help_Center->enqueue_wp_admin_scripts('plugins.php')
    #3 /home/www/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
    #4 /home/www/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #5 /home/www/wordpress/wp-admin/admin-header.php(118): do_action('admin_enqueue_s...', 'plugins.php')
    #6 /home/www/wordpress/wp-admin/plugins.php(605): require_once('/home/klubterre...')
    #7 {main}
      thrown

    I was able to fix the error by tweaking the code in www/wordpress/wp-content/plugins/full-site-editing/help-center/class-help-center.php lines 126-152.

    Original code:

    /**
       * Get current site details.
       */
      public function get_current_site()
      {
        $site = \Jetpack_Options::get_option("id");
        $logo_id = get_option("site_logo");
        $products   = wpcom_get_site_purchases();
        $at_options = get_option("at_options");
        $plan       = array_pop(
        	array_filter(
        		$products,
        		function ( $product ) {
        			return 'bundle' === $product->product_type;
        		}
        	)
        );
    
        return [
          "ID" => $site,
          "name" => get_bloginfo("name"),
          "URL" => get_bloginfo("url"),
          "plan" => [
            "product_slug" => $plan->product_slug,
          ],
          "is_wpcom_atomic" => boolval($at_options),
          "jetpack" => true === apply_filters("is_jetpack_site", false, $site),
          "logo" => [
            "id" => $logo_id,
            "sizes" => [],
            "url" => wp_get_attachment_image_src($logo_id, "thumbnail")[0],
          ],
        ];
      }

    Tweaked code:

    /**
       * Get current site details.
       */
      public function get_current_site()
      {
        $site = \Jetpack_Options::get_option("id");
        $logo_id = get_option("site_logo");
        //$products   = wpcom_get_site_purchases();
        $at_options = get_option("at_options");
        // $plan       = array_pop(
        // 	array_filter(
        // 		$products,
        // 		function ( $product ) {
        // 			return 'bundle' === $product->product_type;
        // 		}
        // 	)
        // );
    
        return [
          "ID" => $site,
          "name" => get_bloginfo("name"),
          "URL" => get_bloginfo("url"),
          "plan" => [
            "product_slug" => "basic", //$plan->product_slug,
          ],
          "is_wpcom_atomic" => boolval($at_options),
          "jetpack" => true === apply_filters("is_jetpack_site", false, $site),
          "logo" => [
            "id" => $logo_id,
            "sizes" => [],
            "url" => wp_get_attachment_image_src($logo_id, "thumbnail")[0],
          ],
        ];
      }

    Commenting out $products = wpcom_get_site_purchases(); and the $plan = array_pop( […] ); prevents the crash, and returning "product_slug" => "basic", //$plan->product_slug, in the response array ensures that the site works properly.

  • The topic ‘FATAL error in 3.49493’ is closed to new replies.