zartgesotten
11/30/2017 - 1:49 PM

Prevent Subscribers from accessing their user profile

<?php
function prevent_subscriber_access(){
    if( current_user_can( 'subscriber' ) && is_admin() )  {
        // do something here. maybe redirect to homepage
        wp_safe_redirect( get_bloginfo( 'url' ) );
    }
}
add_action( 'admin_init', 'prevent_subscriber_access' );
?>