Single Out A Specific User

by LunchBox on March 10th, 2010 in Tips

Have you ever wanted to test out some new code on your WordPress template, but don’t want your readers to see it quite yet?  No problem, there’s an easy way to do this.  Just single yourself out by using the following code:

<?php global $current_user;
get_currentuserinfo();
 
if ($current_user->user_login == "admin"):
//Insert Code Here
endif;
?>

This is, of course, assuming that you are logged in as “admin”.  If not, then replace “admin” with whatever your username is.  This makes it easy for you to preview changes to the template before they are live.

Leave a Comment