Ive seen other similar posts on here asking the same question but cannot seem to find an answer for my situation which is a bit more unique.

I'm building a support website for a product we have and we have taken time to gather this information so we would only like to limit the information to users who have purchased our product and have logged in. The Accounts should be created by the users and then approved by us or alternatively we create the accounts for them.

My issue is then, i don't want these members seeing my dashboard or anything back-end related just front-end. Is there any way to achieve this could anyone direct me in the right place.

Thank you

1 Answer 1


You can simply check if the user has an specific role, and redirect them to homepage if they try to access the admin panel.

function redirect_to_front(){
    // Check if we are on the admin panel, and the user is not an admin
    if( is_admin() && !current_user_can( 'administrator' ) ){
        // Redirect them back to front
        wp_safe_redirect( site_url() );
add_action('init', 'redirect_to_front');

This is just an example. You should alter the code, and change the capabilities to fit your purpose. The current_user_can() function accepts both capability and roles.

  • What about making the website only accesible by 'Registered Users'
    – bLAZYY
    Aug 16, 2017 at 15:44
  • Hi. Just any simple subscribed user? You can use subscriber instead of administrator in that case.
    – Johansson
    Aug 16, 2017 at 15:52

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.