Last Updated: February 25, 2016
·
1.425K
· Kresimir Pendic

Make Wordpress visible to only logged in users

To make some site that is publicly available on,, for ex: address:

http://example.com

only visible to admin roles or developers while working on site online, open your index.php in your active theme and somewhere on the top of that file add next line:

<?php  
if( ! is_user_logged_in() ) exit ;
// rest of the theme calls..
get_header();
// ...

after that, only logged in user will see developement site, and all others, including web crawlers will see beautiful white canvas :)

cheers, k

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

WordPress sites collect scripts from themes, plugins, and tag managers. A compromised plugin update can add a skimmer to every page without a change in your own templates.

Security insights from Cside