My first WordPress plugin — Guest Lock

I wanted to prove myself, that writing WordPress plugins isn’t very hard task. Or, actually, that this can be really, really easy. So I came with this example. This is as simple as possible plugin example. It currently does nothing else except for locking entire front-end of your site for not registered users.

Here is my fantastic code:
[code language=”php”]
* Plugin Name: Guest Lock
* Description: Makes your blog accessible only to logged in users. Displays message to all others.
* Version: 1.0
* Author: Trejder
function show_guest_notice()
echo(‘No way, man!’);

add_action(‘get_header’, ‘show_guest_notice’);

Everything, what this plugin does can be achieved using build-in WordPress solution, so you should consider this plugin as a piece of fun or base template rather than something usable.

Leave a Reply