Wordpress widget error - Uncaught Error: Call to a member function get_header_transparency() on null

Viewed 302

I have received the following from wordpress via email.

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

In this case, WordPress caught an error with one of your plugins, WooCommerce.

First, visit your website (https://myroarie.com/) and check for any visible issues. Next, visit the page where the error was caught (https://myroarie.com/?rest_route=%2Fwpcom%2Fv2%2Fadmin-menu&_for=jetpack&token=i1P3n%28jB6wH1N%26r7x232lJxPhxqmz%2ATQ%3A1%3A194687101&timestamp=1632261925&nonce=MctCrajZ9v&body-hash&signature=o8DhNLuTynTcnt6t1d0MObkibpQ%3D) and check for any visible issues.

I follow that link and get the following error message:

wp-die-message { display: none; }

Fatal error: Uncaught Error: Call to a member function get_header_transparency() on null
in /srv/htdocs/wp-content/plugins/playroom-core/inc/header/headers.php on line 117

Call stack:

PlayroomCoreHeaders::add_body_classes()
wp-includes/class-wp-hook.php:305
WP_Hook::apply_filters()
wp-includes/plugin.php:189
apply_filters()
wp-includes/post-template.php:836
get_body_class()
wp-includes/post-template.php:595
body_class()
wp-includes/blocks/legacy-widget.php:113
handle_legacy_widget_preview_iframe()
wp-includes/class-wp-hook.php:303
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:327
WP_Hook::do_action()
wp-includes/plugin.php:470
do_action()
wp-admin/admin.php:175
require_once()
wp-admin/widgets.php:10

I have investigated the php file that it points towards, but cannot see the issue. Here's the function that the error refers to: (unable to submit message, even after indenting properly, so have shared image link)

function add_body_classes( $classes ) {
        $header_object = $this->get_header_object();

        $header_layout            = playroom_core_get_post_value_through_levels( 'qodef_header_layout' );
        $header_scroll_appearance = playroom_core_get_post_value_through_levels( 'qodef_header_scroll_appearance' );

        $classes[] = ! empty( $header_layout ) ? 'qodef-header--' . $header_layout : '';
        $classes[] = ! empty( $header_scroll_appearance ) ? 'qodef-header-appearance--' . $header_scroll_appearance : '';
        $classes[] = $header_object->get_header_transparency() ? 'qodef-header--transparent' : '';
        $classes[] = $header_object->content_behind_header() ? 'qodef-content--behind-header' : '';

        return $classes;
    }

enter image description here

the header object is defined higher in the script as

class PlayroomCoreHeaders {
    private static $instance;
    private $layout_meta;
    private $layouts;
    private $header_object;

    public function __construct() {

        // Includes header layouts
        $this->include_elements();

        // Set module variables
        add_action( 'wp', array( $this, 'set_variables' ) ); // wp hook is set because we need to wait global wp_query object to instance in order to get page id

        // Overrides default header template of theme
        add_action( 'wp', array( $this, 'render_template' ) );

        // Includes header scroll appearance template
        add_action( 'playroom_action_after_page_header_inner', array( $this, 'scroll_appearance' ) );

        // Add module body classes
        add_filter( 'body_class', array( $this, 'add_body_classes' ) );

        //Add widget areas
        add_action( 'widgets_init', array( $this, 'add_header_widget_areas' ) );
    }

enter image description here

Any ideas on how I can resolve the issue? It is causing issues on the site, specifically the widgets.

0 Answers
Related