Title: Invalid Sample Code
Last modified: May 3, 2018

---

# Invalid Sample Code

 *  Resolved [bigwave2](https://wordpress.org/support/users/bigwave2/)
 * (@bigwave2)
 * [8 years ago](https://wordpress.org/support/topic/invalid-sample-code/)
 * 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;
       }
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finvalid-sample-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Paul Biron](https://wordpress.org/support/users/pbiron/)
 * (@pbiron)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/invalid-sample-code/#post-10384892)
 * Please accept my appologies for the delayed response! For some reason I was never
   notified that you posted this.
 * You are absolutely correct. I will be releasing a new version shortly and will
   be sure to correct that.
 *  Plugin Author [Paul Biron](https://wordpress.org/support/users/pbiron/)
 * (@pbiron)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/invalid-sample-code/#post-10393516)
 * I just released v1.1. In that version I’ve removed the code sample (and other
   Dev Notes) from the readme and replaced it with a link to the documentation on
   [github](https://github.com/pbiron/shc-show-env), which has been updated as you
   suggested.
 * Also, that github documentation was been rewritten to hopefully be more clear.
 * Thanx again for the report.
 *  Thread Starter [bigwave2](https://wordpress.org/support/users/bigwave2/)
 * (@bigwave2)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/invalid-sample-code/#post-10394058)
 * Thanks for the quick response (once you knew about it)
 * Ian

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Invalid Sample Code’ is closed to new replies.

 * ![](https://ps.w.org/show-environment-in-admin-bar/assets/icon-128x128.png?rev
   =1710251)
 * [Show Environment in Admin Bar](https://wordpress.org/plugins/show-environment-in-admin-bar/)
 * [Support Threads](https://wordpress.org/support/plugin/show-environment-in-admin-bar/)
 * [Active Topics](https://wordpress.org/support/plugin/show-environment-in-admin-bar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/show-environment-in-admin-bar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/show-environment-in-admin-bar/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [bigwave2](https://wordpress.org/support/users/bigwave2/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/invalid-sample-code/#post-10394058)
 * Status: resolved