Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Invalid Sample Code

$
0
0

Replies: 0

Hi,
The sample code for checking against the host name doesn’t work. I believe that there should be two closing brackets after each $_SERVER['HTTP_HOST']

add_filter( 'shc_show_env_id_env', 'my_show_env_id_env' );

function my_show_env_id_env( $env ) {
    // match staging.example.com
    if ( preg_match( '/\bstaging\b/i', $_SERVER['HTTP_HOST'] ) {
        return array( 'Staging', 'staging' );
    }
    // match qa.example.com
    if ( preg_match( '/\bqa\b/i', $_SERVER['HTTP_HOST'] ) {
        return array( 'QA', 'qa' );
    }

    return $env;
}

Viewing all articles
Browse latest Browse all 59525

Trending Articles