Did you know there’s a members-only content feature built right into WordPress? It’s a little buggy, which is probably why it’s not more well-known. If you change a post or page to privately published, only logged-in users who can see private posts and pages will be able to see it.
By default, editors and administrators are allowed to read private posts and pages. If you want other roles to be able to read private content, you’ll need to edit the roles’ capabilities. You can [link id=”2717″]do it by hand[/link], if you’re comfortable pasting code into your theme functions file, or you can use a plugin that lets you edit roles. This is Justin Tadlock’s Members plugin. Among other things, you can choose which roles can edit or read private posts and pages — or you can [link id=”2721″]create a whole new role[/link] for that purpose.
Those bugs I mentioned? First, private pages are never included in page lists or menus, even if you’re logged in and you have permission to read them. That includes the Parent dropdown on the Page Edit screen, which means you can’t create a hierarchy of private pages. (You might have noticed the same is true for drafts, too.) All of this is due to a single bug in an underlying function. Hopefully it’ll get fixed one of these days.
However, if you can live with (or work around) these bugs, the built-in privacy feature is a handy, no-plugin-required way to create a members-only area.
Find all the WordPress Hidden Gems in [link id=”2675″]Beginning WordPress 3[/link].