ViewLevel 2.0 lets you hide specific posts from users below a given user level. This is a port of Kendra Burbank's excellent ViewLevel plugin to Wordpress 1.5.

There is a new options page for setting the default viewlevel. Filtering is now done at the SQL stage, so unprivileged users now see the top ten viewable posts. In Kendra's version, the filtering was done in the loop, so sometimes casual viewers might not see any posts at all, even when they should have been able to.

Latest version: 2.0.0
Released on: 25th August, 2005

Download it here:

ViewLevel 2.0 is compatible with WordPress 1.5.2. ('Natures Revenge' has e-mailed me to say that it works on WordPress 2.0, but I can't personally confirm this.) No hacks or source code editing are required. If you have any questions or comments, then please subscribe to themailing list.


When posts have a custom field called “viewlevel� set, only lets users with that user level or above see the post.

As a shortcut, you may add text like “vl=3″ into posts to set the viewlevel. If you want to make a post visible to everyone, then use "vl=*". (If you actually want to say "vl=3" in your post, then use an 'entity reference' for the '=', like this: "vl=3".)

If you don't set the viewlevel, then the post is assigned a default. You can set this default on the new ViewLevel Options page. To start with the default is '*', so everyone will be able to see your posts.

Optional template change

If you want to mark restricted posts with the padlock icon, then change your index.php so that the post title part looks like this:

<h2 class="posttitle" id="post-<?php the_ID(); ?>">
 <a href="<?php the_permalink() ?>" rel="bookmark">
  < ?php if(function_exists('vl_restricted'))vl_restricted(); the_title(); ?>

The crucial part is the if(function_exists('vl_restricted'))vl_restricted();. This calls the new vl_restricted() template function if it exists.

vl_restricted() takes a couple of optional parameters that you can use to customise what it does. Read to code for further details.

Frequently Asked Questions

Q: Can I restrict posts to only registered users?

A: Yes. As of v2.0.0 you can set a post to 'vl=*' (or 'vl=-1'), which means that everyone can see the post. 'vl=0' means that only registered users can see the post.

Q: Can I display a message when a post is hidden?

A: No! The restricted posts are filtered out at the SQL level, so they are completely hidden, as though they were never there. Some users like this feature, but not everyone. If you want to let your users know when something is hidden, then you'll have to find a different plugin. Sorry.

Known Bugs

Comment feeds for restricted posts are visible to everyone. (Unconfirmed)