I was gonna call this plugin “Bouncer” but settled for a more explanatory name instead.
This plugin will allow only registered users of your blog to view the blog. If you have a wordpress powered blog that you don’t want your parents, or the secretary in your office, or the POTUS, to read it(okay, well, I can’t guarantee the last one :P), then View source and save or Download the .zip file to start using it. This will effectively password protect your wordpress blog, and also prevent search engines from indexing the pages in the blog.
- Save the file registered_only.php to your wp-content/plugins folder
- Activate the plugin from the plugin administration page
- If you really want your defense against unscrupulous readers to be strong, then disable the “Anyone can register” option in Options->General in your WordPress administration interface.
- If you want google and other search engines to be able to index your blog pages, then comment(add two // in the beginning of) the line
echo '<meta name="robots" content="noindex,follow" />';. This, however, would mean that the search engines might index your pages and if you want a “private” blog, then this would not be suitable, which is why is it uncommented by default.
- If you are getting a “headers already sent” warning, then try adding the following one line to your .htaccess file (create a file called .htaccess if you don’t have one already) :
PHP_FLAG output_buffering on
This plugin is basically the auth.php file that ships with WordPress 1.2, adapted to fit needs, and is distributed under the GPL license.