This plugin will very easily let you restrict content on your WordPress site to registered users. It permits you to restrict entire posts / pages or individual sections of content within a post or page.
Features
- Restrict entire posts / pages.
- Restrict sections of content.
- Unlimited number of restricted areas.
- Works with all Custom Post Types
- Five restriction levels – uses WordPress’s regular user levels.
- Hide content displayed in WordPress feeds.
Usage
First upload to wp-content/plugins and click activate from the WordPress plugins menu.
To restrict an entire post or page, simply select the user level you’d like to restrict the post or page to from the drop down menu added just below the post/page editor.
To restrict just a section of content within a post or page, you may use shortcodes like this:
[restrict userlevel="editor"] . . . your restricted content goes here . . . [/restrict] |
Accepted userlevel values are:
- admin
- editor
- author
- subscriber
- contributor
There is also a short code that can be used for showing content to users that are not logged in:
[not_logged_in]This is only shown to non-logged-in users[/not_logged_in] |
A premium version of this plugin can be found here.
Very nice Pippin, always a handy tool to have on multi-user sites! And congrats on the site launch, it’s looking great around here! 😀
Thanks Michael! Good to see you around here 😉
Cool! Looking forward to seeing what’s in the premium version!
Great plugin! Just had one question, if you set the restriction to subscriber, will, lets say editors, still see it as well? Meaning is it restricted solely to subscribers or is it restricted to subscribers and those who have greater privileges?
Setting it to Subscriber will make it so only subscribers and any user with a high level can see it. So, yes, user levels cascade up.
Awesome – thanks for the quick reply!
Just started using it….really handy…
where can I change the error code from “This content is restricted to subscriber” to “This content is restricted to registered users only” ?
@Matt – open restrict_content.php, find the message you want to change, and modify to your heart’s desire 🙂
HTML’s code and Link code works in message. That’s OK?
Are you asking if HTML does work in the messages, or saying that it does and shouldn’t?
Cool plugin – I am definitely going to run some tests on this one. Thanks a lot !
I just upgraded to latest, and do not want restrict content metabox in custom post edit windows; how can I keep to only post window? Many thanks,
Jim
@Jim – Open metabox.php inside of the includes folder and change line 39-41 to this:
add_meta_box($rc_meta_box['id'], $rc_meta_box['title'], 'rcShowMetaBox', 'post', $rc_meta_box['context'], $rc_meta_box['priority']);
Hi, I also want to hide the link to the restricted page in the navigation menu, how do i do it.
@Khurram – this is not currently possible.
Hi Pippin,
Has or Will this aspect change in the future? Thanks
No, this will not change. I’m hoping to add it to the Pro version, but not this one.
Pingback: Retrieve Users Based on Meta Value | Pippins Plugins
Pippin,
Love the plugin, I am using the Members plugin to create new User Roles Other then the standard wordpress “Admin, Editor and so on…” Is there a way to add the new roles to the settings.php so that these new roles can be restricted?
Thank you,
Will
Will, no, there is not a way, not unless you’re comfortable editing the code. I can direct you on how to do that if you want.
Pingback: Preview of Restrict Content Pro | Pippins Plugins
Is there anyway to have a popup/popover window to login when a user doesnt access to specific content?
No, sorry.
It would be handy if there was a setting to have all posts restricted by default – I achieved this effect by editing metabox.php but, obviously, that mod will be lost if I update the plugin.
It would also be useful if there was some way to restrict not just the post but also the comments beneath it. I am testing Restrict Content for use as part of a bug tracking site (you can see my experiment here: Abster) and, in that use case, comments could be just as sensitive or valuable as the post itself.
That would be nice, but I don’t plan to add it.
The ability to restrict comments has been asked for so many times, and I was planning to incorporate it into the Pro version, but after hours of tinkering, I couldn’t find a good way to do it. The only method I found that worked well was to modify the theme’s template file and wrap the comments_template() function in a conditional tag to check whether the current user has access.
Well, a step-by-step guide on how to do that, for people willing to hack their theme template, would be a pretty good premium article.
How about the other idea, a settings option to make all new posts restricted by default? I can think of a lot of scenarios in which that would be useful, not just bug trackers.
Well the free version doesn’t have a function that would allow you to do that. The Pro version does, and I could certainly do a tutorial on restricting parts of a theme for the pro version.
I’ll think about updating for a “restrict by default” setting.
Cool, I’ll keep an eye on RCP updates and buy if the default setting appears, and the tutorial would be the cherry on top, leaving comments visible is less than ideal. Thanks Pippin.
Hey donnacha,
can you tell me how you edited metabox.php so that is defaults to a set level?
thanks
Pingback: TutsPress | 20+ Helpful Free Wordpress Plugins Powered by Pippins
Hello!
cool plugin thank you.
I have one question, how can I use this plugin to custom fields,?
What do you mean? Do you want to restrict custom fields?
yes costom fields is that possible? 🙂
It depends on how you are displaying the custom fields. The plugin has a shortcode that can restrict anything inside of it.
can I have an equivalent in php for that shortcode I can use it in my theme files
Yeah, is_user_logged_in() and current_user_can(). Those are the two functions used by the plugin.
thank you 🙂 Pippin
Great plugin! I just wondered if you’ve encountered a problem with a search field box that comes up with posts that are supposed to be restricted. Ex. on my site, if you type in “how do I” in the search box, it comes up with several posts which I have restricted to author’s access. It doesn’t show the content but I’d rather the title of the post didn’t show up at all. Any ideas?
Sorry but there is not a way to hide the post titles as well. The Pro version includes an option that will hide the titles completely, but not the free.
Is Googlebot able to index the restricted content for Restrict Content free version?
I’d like our visitors to register before receiving full access to our online articles, but I hope that our Google rankings will be unaffected by this…
Any thoughts?
No, the content is not indexed. If it were, then people would be able to access your content through Google without registering.
Does it support bbPress forum this plugin?
You should be able to restrict content in forums and topics with the short code, but the meta box won’t work in bbPress. I am, however, working on an official add-on to the Pro version which gives complete bbPress support.
Is it available that shortcodes for bbpress in free version?
There is a single [ restrict ] shortcode available in the free version that should work in bbPress.
I try but doesnt work..it show shortcode instead of hiddibg.Maybe i did something wrong.Im using WP with buddypress and bbPress forum.I tryed in forum topic first [restrict userlevel="Subscriber"] bla bla bla [/restrict]
and didnt worked and i tryed also [restrict] bla bla bla [/restrict] and set in dashnoard messages and still didnt worked.Im missing something or it cant be done on this way?
thanks
It sounds like your bbPress/WordPress theme is processing short codes in bbPress forums. Try using a short code from any other plugin. If it doesn’t work either, then you will not be able to use it, sorry. bbPress uses a different method of displaying Forum/Topic content, so short codes do not always work.
Other shortcodes working for example im making 3D rotating icons for simple social share plugin you can see on my website velikisiljegovac.com after each post and those shortcodes working.Is it enough to put literally [restrict userlevel="subscribers"][/restrict] to hide whole topic or i must put in middle which part i want to hide?
Hmm, interesting.
If you wanted to hide some text, you would do:
[restrict]The text to hide...[/restrict]
The default restriction level is “subscribers”.
Anyway if it wont work thanks for support 🙂
Nope 🙂 guess i will wait some of next releases for that 🙂 thanks for helping me 🙂
interesting !!!
cool
Hi
I know you can customise the message displayed to diffrent users
Just wondering if its possible to add html to this so i can add a link to the registration / login page?
checked the restrictcontent.php as mentioned in an earlier comment but couldnt find the message to alter
any help is appriciated 8o)
Yes, you can add HTML to the messages. The messages are defined in the Settings page.
Hey,
I found your plugin and its simple really what im searching for, very nice… I have only one thing which i really miss and i cant find anywhere, i want to configure your script to simply hide completely those posts which is not on your level… not just the content. I would like to hide the existence of posts from those users who dont have access level to read them.
Im not collecting followers i dont want to wake up the curiosity in people for more, etc…
Im writing a blog but some post is really not for everyone… if you know what i mean, and i dont want people to ask what they cant see…
Is there any chance, or can you recommend me something ?
Thx in Advance.
I’m glad you like the plugin! The feature you described is not included, and probably won’t make it in at any point.
I have built that feature into the Pro version, but it works a little differently and is not based off of user levels.