0

Inside index.php I used wp_safe_redirect to redirect users to the main global page if users write a false url.

I have 1 domain and three subdomains. These subdomains refer to php files and not to child themes or multisite.

    $Subexplode = explode('.', $_SERVER['HTTP_HOST']);
    $SubName = array_shift($Subexplode);
    $A = 'domainname';
    $B = 'subdomain1';
    $V = 'subdomain2';
    $H = 'subdomain3';
    
    if($SubName === $B || $SubName === $V || $SubName === $H){
        $redirectUrl = '/reception';
        if(is_home()){
            header_remove();
            wp_safe_redirect($redirectUrl);
            exit;
        }
    }

WordPress auto php analyse refuse, inside theme files editors, from Tuesday 10 Jan to validate php file with fatal error : "Unable to send a message to the site to check for fatal errors."

wp_safe_redirect('/') is the only function/line that interrupt wordpress analyse and validation file during update theme files.

4
  • what do you mean by wordpress analyse? Is this a tool or service? Your question is difficult to understand, what do you mean by auto php analyse? Where is the code in your question located and when does it run?
    – Tom J Nowell
    Jan 11 at 18:09
  • Inside Wordpress Theme editor, each time I edit a php file and if I a bracket, curly bracket , comma, etc is missing Wordpress stop the update of the file and display an error that correspond to my error. I'll edit question. The problem/the code is located in index.php. My code works fine before Tuesday 10 January 2022. None of plugins is concerned by this error ! Currently I work with Maptiler and MapLibre but It is only javascript library and they can't be link with php $_SERVER['HTTP_HOST'] ! My website is entirely developed by me. Two external plugins are: TinyMCE and Classic Editor !
    – imagIne
    Jan 15 at 12:55
  • You might try using an external editor instead of the theme editor in the WP backend, since the backend editor also exists on the domain you're redirecting. Also, have you set a static homepage in the WP settings? is_home(), despite its name, only works with the blog page, so you have to use is_front_page() if you've set a static homepage.
    – Shoelaced
    Jan 15 at 15:12
  • I will try, sorry for late answer.
    – imagIne
    Jan 23 at 14:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.