[QuickTip] [WP] Quickly tell which environment you're in!

I figured I’d start a series of QuickTips so that community members can gobble up some bits of info as they’re perusing. These are for things that are too short for articles or so obvious they never get mentioned (but should). Prepend your title with [QuickTip] so we know to stop by :smile:


If you’re in the habit of using a Staging/Production environment (and you should be) a way to quickly know which environment you’re in is to use different admin schemes. I like to use Sunrise for staging and Midnight for production. You can change this by visiting Users > Your Profile

vs

If you have multiple writers, another trick is to use an altered favicon so that everyone knows regardless of what scheme they use. Again, I like to use red vs normal:

Getting the favicon in there is a little more involved, but not by much! Just drop this into your functions.php:

function adminFavicon() {
    $favicon = get_stylesheet_directory_uri() . '/favicon-admin.ico';
    echo '<link rel="shortcut icon" href="' . $favicon . '" />';
}

# Only show on the admin side (the login too, why not?)
if($_SERVER['HTTP_HOST'] === 'something.com'){
    add_action('login_head', 'adminFavicon');
    add_action('admin_head', 'adminFavicon');
}

Bonus: If you listen to music while you code, tie your left earbud in a knot so you can quickly put them on correctly without looking :slight_smile:

4 Likes

Nice tip, thanks for sharing labofoz. I like the bonus tip too :wink:

1 Like

Haha thanks Chris!

This is great, I’d never thought of changing the favicon — very useful when you have a million test tabs open!

1 Like

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