Hi Brajesh,
I do not want any user other than site admin to access the wp-admin page. Is there a way to redirect users to 404 page when they try to access this page?
Faster, better and easier!
Hi Brajesh,
I do not want any user other than site admin to access the wp-admin page. Is there a way to redirect users to 404 page when they try to access this page?
Hi Gwu,
here the code you can put in the functions.php or bp-custom.php
add_action("init","redirect_subscriber");
function redirect_subscriber(){
if(!is_admin())
return;
if(is_user_logged_in()&&!current_user_can('edit_posts')){
wp_safe_redirect (get_bloginfo ('home'));
exit(0);
}
}
It will allow all non subscribers(contributors and above to visit the dashboar but the subscribers will be redirected to site home page).
Please do let me know if that helps or not.
You must log in to post.