I'd like to have a site set up so people can register as subscribers, after which point I'd want them only to be able to access their profile on the backend and then the full front end site.
I'm having trouble at the moment figuring out how to keep them from being able to access /wp-admin/index.php (the dashboard) after they've logged in. They are taken automatically to their profile since they are subscribers, but they can access index.php, so this isn't urgent but I'd like it to be clean.
I tried the following with no results
function logged_in_home_redirect() {
if( ($current_url = home_url( '/wp-admin/index.php' )) && !($current_url = home_url( '/wp-admin/profile.php' ))) {
wp_redirect( home_url( '/wp-admin/profile.php' ) );
exit;
}
}
if (!current_user_can('administrator')) :
add_action( 'init' , 'logged_in_home_redirect' );
endif;
I'm looking for something quick and effective to plop into my functions.php file. Thanks in advance for any assistance that can be offered.