Global Blocks not working because of a PHP code

Hello! I run a few websites, and I’ve been getting an error when I try to edit any Global Block. Here is the screenshot of the error - https://ibb.co/NSwxsK1

I noticed that there’s a specific code in every website that seems to be conflicting with Global Blocks. I have a custom PHP code to redirect 404 page to home page, which is listed below.

function WPTime_redirect_404_to_homepage(){
    if( is_404() ){
        wp_redirect( home_url(), 301 );
        exit();
    }
}

add_action('template_redirect', 'WPTime_redirect_404_to_homepage');

Just wanted to bring it to your attention.

Hi Malav,

Thank you for reaching out to us. Instead of a custom code to redirect 404 page to any page, please use the Custom 404 extension which can be found via X/Pro > Validation screen:

image

To learn more about Custom 404 extension please see https://theme.co/docs/custom-404

Hope this helps!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.