Skip to content

Instantly share code, notes, and snippets.

@lynt-smitka
Created August 25, 2019 18:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lynt-smitka/cff79cc29b3b25441dcce84550ae4caf to your computer and use it in GitHub Desktop.
Save lynt-smitka/cff79cc29b3b25441dcce84550ae4caf to your computer and use it in GitHub Desktop.
//hide admin bar for subsribers
function lynt_hide_admin_bar() {
if (current_user_can('subscriber')) show_admin_bar(false);
}
add_action('after_setup_theme', 'lynt_hide_admin_bar');
//redirect subscribers to homepage after dashboard visit attempt
function lynt_block_dashboard() {
if (current_user_can('subscriber') && is_admin() && ! wp_doing_ajax() ) {
wp_redirect(home_url());
exit;
}
}
add_action('admin_init', 'lynt_block_dashboard');
/*
//Customized login message
function lynt_login_msg() {
return '<p class="message">Message</p>';
}
add_filter('login_message', 'lynt_login_msg');
*/
//Allow specific pages only for logged in users: https://gist.github.com/lynt-smitka/935a6b28fcdbc7555277aa7075b6733f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment