• Hey,

    I’m running WordPress 5.9.2, and I get this error:

    
    An error of type E_ERROR was caused in line 23 of the file /var/www/wordpress/wp-content/plugins/gutenberg/lib/compat/wordpress-5.9/render-svg-filters.php. Error message: Uncaught Error: Call to undefined function get_current_screen() in /var/www/wordpress/wp-content/plugins/gutenberg/lib/compat/wordpress-5.9/render-svg-filters.php:23
    Stack trace:
    #0 /var/www/wordpress/wp-includes/class-wp-hook.php(307): gutenberg_global_styles_render_svg_filters()
    #1 /var/www/wordpress/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #2 /var/www/wordpress/wp-includes/plugin.php(474): WP_Hook->do_action()
    #3 /var/www/wordpress/wp-includes/general-template.php(3074): do_action()
    #4 /var/www/wordpress/wp-content/themes/simplemag-child/header.php(20): wp_body_open()
    #5 /var/www/wordpress/wp-includes/template.php(770): require_once('/var/www/wordpr...')
    #6 /var/www/wordpress/wp-includes/template.php(716): load_template()
    #7 /var/www/wordpress/wp-includes/general-template.php(48): locate_template()
    #8 /var/www/wordpress/wp-content/themes/simplemag-child/404.php(8): get_header()
    #9 /var/www/wordpress/wp-includes/template.php(772): require('/var/www/wordpr...')
    

    As a temporary fix, I’ve added this line in wp-content/plugins/gutenberg/lib/compat/wordpress-5.9/render-svg-filters.php function gutenberg_global_styles_render_svg_filters():

    
    if ...
    function_exists( 'get_current_screen' ) &&
    

    Making it:

    
    function gutenberg_global_styles_render_svg_filters() {
    	/*
    	 * When calling via the in_admin_header action, we only want to render the
    	 * SVGs on block editor pages.
    	 */
    	if (
    		is_admin() &&
    		function_exists( 'get_current_screen' ) && /* Temporary fix */
    		! get_current_screen()->is_block_editor()
    	) {
    		return;
    	}

    `

    I don’t know if this is a good fix, if so it should be integrated to the code, otherwise, I’d like to hear about a better one…

    Thank you.

    • This topic was modified 2 years, 12 months ago by ddyok.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Is this error on all the pages or just on 404 page?

    Thread Starter ddyok

    (@ddyok)

    Hey Vijay,

    So far seems to be only on the 404 (though at present moment I don’t know how to reproduce this at whim). I had this in 5.9.1, too, by the way.

    Thank you..

    Can you share your child theme 404.php and header.php file code so that I could test this issue?

    Note: please remove any private information from file code.

    • This reply was modified 2 years, 12 months ago by Vijay Hardaha.
    Thread Starter ddyok

    (@ddyok)

    Child theme header.php:

    <?php
    /**
     * The Header for the theme
     *
     * @package SimpleMag
     * @since 	SimpleMag 1.0
    **/
    ?>
    <!doctype html>
    <html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php bloginfo( 'charset' ); ?>">
        <meta name="viewport" content="width=device-width, minimum-scale=1">
        <meta name="theme-color" content="#000000">
        <link rel="profile" href="https://gmpg.org/xfn/11">
        <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    <?php wp_body_open(); ?>
    
        <section class="no-print top-strip">
    
            <?php global $ti_option; ?>
    
            <div class="wrapper">
    
                <div id="mobile-menu-reveal" class="icon-button mobile-menu-reveal"><i class="hamburger-icon"></i></div>
    
                <?php
                // Top Strip Logo
                simplemag_top_strip_logo();
                ?>
    
                <?php
                // Secondary Menu
                simplemag_menu( array(
                    'theme_location' => 'secondary_menu',
                    'wrapper_class'  => 'secondary-menu',
                ) );
                ?>
    
                <?php
                // Hide Search and Social Icons if header variation with search is selected
                if ( isset( $ti_option['site_header'] ) && $ti_option['site_header'] != 'header_search' ) { ?>
    
                    <div class="right-side">
    
                        <?php
                        // Social Profiles
                        if( $ti_option['top_social_profiles'] == true ) {
                            get_template_part ( 'inc/social', 'profiles' );
                        } ?>
    
                        <?php
                        // Search Form
                        if ( $ti_option['site_search_visibility'] == true ) {
                            simplemag_search_modal_button();
                        } ?>
    
                        <?php simplemag_top_strip_right_side(); ?>
    
                    </div>
    
                <?php } ?>
    
            </div><!-- .wrapper -->
    
        </section><!-- .top-strip -->
    
        <?php
        // Main Logo Area
        if ( isset( $ti_option['site_main_area'] ) && $ti_option['site_main_area'] == true ) :
        ?>
        <header id="masthead" class="site-header" role="banner" class="clearfix">
            <div id="branding" class="anmtd">
                <div class="wrapper">
    			
    				<div class="top-title"><a href="/">THE DECADENT REVIEW</a></div>
    	
               		<?php
                    /**
                     * Header Variations
                     * are selected in Theme Options, Header tab.
                    **/
    
                    // Logo, Social Icons and Search
                    if ( $ti_option['site_header'] == 'header_search' ) {
                        get_template_part( 'template-parts/header/header', 'search' );
    
                    // Logo and Ad unit
                    } elseif ( $ti_option['site_header'] == 'header_banner' ) {
                        get_template_part( 'template-parts/header/header', 'banner' );
    
                    // Default - Centered Logo and Tagline
                    } else {
                        get_template_part( 'template-parts/header/header', 'default' );
                    }
                ?>
                </div><!-- .wrapper -->
            </div><!-- #branding -->
        </header><!-- #masthead -->
        <?php endif; ?>
    
        <?php
        // Header Fallback
        if( ! class_exists( 'Redux' ) ) :
            get_template_part( 'template-parts/header/header', 'fallback' );
        endif;
        ?>
    
        <?php
        // Main Menu
        $fixed_menu_class = '';
        if ( isset( $ti_option['site_fixed_menu'] ) ) {
            $fixed_menu = $ti_option['site_fixed_menu'];
            $fixed_menu_class = ( $fixed_menu == '3' ) ? ' is-fixed' : '';
        }
    
        simplemag_menu( array(
            'theme_location' => 'main_menu',
            'wrapper_class'  => 'no-print anmtd main-menu' . esc_attr( $fixed_menu_class ),
            'mega_menu'      => true,
        ) );
        ?>
    

    Child theme 404.php:

    
    <?php 
    /**
     * 404 error page
     *
     * @package SimpleMag
     * @since 	SimpleMag 1.0
    **/ 
    get_header(); ?>
    	
        <section id="content" role="main" class="clearfix anmtd">
        
        	<div class="wrapper">
        
                <article id="post-0" class="post error404 not-found">
                    
                <div class="notfound">
                    404<br>
                    PAGE NOT FOUND
                </div>
                    
                </article><!-- #post-0 .post .error404 .not-found -->
                
        	</div>
            
        </section><!-- #content -->
    	
    <?php get_footer(); ?>
    

    Thanks, can you also tell me if you are using the latest version of the Gutenberg plugin, or any old version?

    Thread Starter ddyok

    (@ddyok)

    I’m on Gutenberg 12.9.0 (I think that’s the latest).

    Ok thanks, I will try to reproduce the error.

    Thread Starter ddyok

    (@ddyok)

    Thank you. Let me know if I can assist in any way.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Call to undefined function get_current_screen() in render-svg-filters.php:23’ is closed to new replies.