1

I’m running a private site login users have access to the front-end using [My Private Site plugin][1] However I would like to restrict subscribers users who are login from accessing frontend and keep them on the admin dashboard (backend)

any Functionality I can use to add on the theme function file to restrict subscribe from accessing front-end based on user roles?

Thank You

2 Answers 2

1

https://wordpress.org/plugins/restrict-content/ is a kind of solution. Check out.

1
  • That plugin only restrict users from reading content pages or posts it's a membership plugin. What i'm looking is restrick subscriber from accessing frontend if the subscriber trys to go to frontend example www.yousite.com it will direct them back to the dashboard.
    – Hamadi
    Commented Jan 29, 2017 at 18:10
1

Hello :) I'm a newbie but I think this will help you a bit at least... Please coorect me if there are any mistakes :) I didn't test this code

// Block subscribers from accessing the WordPress front-end function wpabsolute_block_users_frontend() { if ( !is_admin() && ! current_user_can( ! 'administrator' ) && ! wp_doing_ajax() ) { wp_redirect( *url u want to redirect* ); exit; } } add_action( 'init', 'wpabsolute_block_users_frontend' );

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.