Last active
December 13, 2023 15:33
-
-
Save 1naveengiri/53620b82fbbb5aef7f060cac2616eff4 to your computer and use it in GitHub Desktop.
Disable admin panel for the subscribers and add wp-login.php to custom login page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'show_admin_bar' , 'bd_disable_admin_bar'); | |
function bd_disable_admin_bar($show_admin_bar) { | |
return ( current_user_can( 'administrator' ) ) ? $show_admin_bar : false; | |
} | |
add_action('init','redirect_to_login_page'); | |
function redirect_to_login_page(){ | |
global $pagenow; | |
if( 'wp-login.php' == $pagenow ) { | |
wp_redirect('http://site.com/login/'); | |
exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment