In this article, I will show you how to modify WordPress default login page.
- Change url of login logo. By default, if you click to login logo, it will redirect you to wordpress.org, it’s really inconvenient, but don’t worry, you can use this code to change url of login logo, replace
home_url()
to any url you want.
1 2 3 4 5 6 |
add_action( 'login_headerurl', 'login_logo_url' ); function login_logo_url() { return home_url(); } |
- Change the title of login logo.
1 2 3 4 5 6 |
add_action( 'login_headertitle', 'login_logo_title' ); function login_logo_title() { return 'Whatever!'; } |
- Change the login logo.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
add_action( 'login_enqueue_scripts', array( $this, 'login_logo' ) ); function login_logo() { echo ' <style type="text/css"> body.login div#login h1 a { background-image: url('your image url'); background-size: contain; width: 100%; } </style>'; } |
- Redirect to another page instead of admin dashboard after login success.
1 2 3 4 5 6 |
add_filter( 'login_redirect', 'redirect_after_login' ); function redirect_after_login() { return home_url(); } |
Hope you like these tricks!