I need to create specific sections of my site which should only allow certain users to access them.

So basically, I'll be having a staff section - if the user is a staff member, they'll see a link to the section and obviously be able to see all the info there.

I've looked into a couple of things, namely adding user roles but they all seem to have a set list of capabilities that I can set. There isn't anything that I can find that will allow me to restrict users access to certain parts of the site.

I don't mind using plugins or anything like that - any suggestions would be welcome.

2 Answers 2


You could create a new role, say staff, and add the users you want to that specific role. Then link that role a new capability of your choice, e.g. access_staff.

Now you have a new role with a new capability, so all you need to do to restrict the access to any part of the site is add this piece of code:

if ( is_user_logged_in() && current_user_can( 'access_staff' ) ) {
    // Section
} else {
    // Let them know they don't have enough privileges or...
    wp_redirect( wp_login_url( get_permalink() ) ); // Send them to the login page 

If your needs are simple, the Log Me In custom login plugin might do. You can control what user roles have access to the dashboard and select a custom set of links displayed on the front end to the user when logged in. If this isn't sufficient there are lots of membership plugins available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.