Hiding blog from guests or setting up ‘Under Construction’ site

WPRecipes has a quick and clean example of using shortcodes in WordPress in general and a particular example of restricting part of post (text, media or anything) to be visible only to registered users. This is quite nice example of doing so, without need of extra plugin for this purpose. You could also learn from here an overall knowledge of using shortcodes in WordPress, if you’re not familiar with that.

Keep in mind that this tips is for hiding part of post from guests. If you want to hide entire post, simply publish it as Private (all posts and pages are published as Public by default) — look in post or page settings.

Ideas, on how you can use this feature, are countless and limited only with your imagination. Starting from showing some stats only to registered users to some game clans’ blogs where you present only general info to guests and more detailed to registered ones. You can use the very same feature to give guests a detailed description of software or media you have, but hide download link from them until they decide to register within your blog.

If you want to hide entire blog from non-registered users, you can find many WordPress plugins for that:

First three are the only plugins that has been recently updated.

All others are at least two years old and therefore hasn’t been tested with new WordPress 3 branch. Last one (Wp-Private) offers quite similar functionality like mentioned in WPRecipes article — you can hide only part of your contents from not registered users.

underConstruction is the only plugin, that does not display (or redirect to) WordPress login page. Instead, it shows you “comming soon” page, where you can manually put a link to wp-login.php script to login yourself to “blocked” page.

It has also many other cool features:

  • easy way to display own, custom HTML code,
  • white list of IP addresses allowed to access page,
  • an ability to use different redirect methods and many more.

For this reasons, I’ve decided to use this plugin.

Forcing user to login before viewing blog contents fails completely on WordPress Network that uses subdomains, with Domain Mapping plugin activated. This is because WordPress stores login cookie for original subdomain and it is not available for domain to which Domain Mapping redirects to.

For details refer to:

Thus, most of above mentioned plugins (as good as many non-plugin examples) won’t work in this situation.

Leave a Reply