Restricting Posts

Block Posts by Default

Under the Options tab in the plugin admin panel, the first option is Block Posts by Default.  Turning this on will do what it says, “block all posts by default.”  Likewise, if you leave it off, all posts will be left unrestricted by default.  Whatever you have here is what we will refer to as the “default setting for posts.”  We will discuss how to override this setting at the individual article level separately.

Something that is important to note about posts is that there are many places that a post can show up.  There are theme pages, such as the home page, archive, and search, that will show either full articles or excerpts, depending on whether you define an excerpt or not.  You can define an excerpt either using the excerpt field in the post editor, or you can use what is known as the ‘more’ tag.  (Read More about The Excerpt from the WordPress® Codex)  Either of these methods will cause WP to only display a “teaser” of your content on one of these summary pages rather than full content.  In order to protect posts, WP-Members™ requires that you use an excerpt, preferably by use of the ‘more’ tag.  In this way, your specified excerpt will display to anyone on the summary pages, but a registered user must be logged in to view the full content.

Write your content and put the ‘more’ tag at the point you want to restrict the post from non-registered users.  This will create your “teaser” content to be used on summary pages and will restrict the remainder of the content unless a user is logged in.

Override the Default Setting for Posts

What if you have set the default to block all posts by default but you have some content that you would like anyone to be able to view?  In the upper right hand corner of the Post and Page editor windows, there will be a WP-Members meta box.  This will contain a checkbox allowing you to override the default setting you have for Posts (or Pages, when in the Page Editor).

For example, if you have set the plugin to block posts by default, this checkbox will allow you to unblock this individual post.  Check the box and update the post.  That’s all you need to do.

Custom Post Meta

The checkbox takes the place of the plugin’s former method of setting a custom field (post meta).  However, the information on the post meta custom field is discussed here because (a) that is what the checkbox is setting, and (b) you may need this information if you are seeking to do some custom programming that might display all free posts, or putting an icon next to posts based on blocking status.  These are things you would need to know how the meta fields are set so that you could filter accordingly.

The custom post meta that is set is “_wpmem_block”.  The underscore (“_”) indicates that this post meta will not show in the custom fields dialog.  A value of “1” is blocked, “0” is unblocked.


In choosing your default setting, consider whether more of your content will be restricted than unrestricted or vice versa.  Set the default setting accordingly.  Then you can override that for any posts that are opposite of the default setting.