Lock Re-Skin to User ID

Re-skinning live sites can be tricky and sometimes unavoidable.

I use the following snipped to target updated versions of stylesheets, headers and footers, and lock them to my user ID so all of the changes are only visible to myself until the theme is ready to launch.

$current_user = wp_get_current_user(); 

if ( 7 == $current_user->ID ) { // If this number matches the ID of the current logged in user 

include('header_new.php'); // load the new header (or other file) 

} else { 

get_header(); // if not load the default 

}

You can find out how to retrieve the user ID here.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.