I’ve enqueued a style for my WordPress login page like so:
function login_stylesheet() {
wp_enqueue_style( 'custom-login', plugins_url( 'style-login.css', __FILE__ ) );
}
add_action( 'login_enqueue_scripts', 'login_stylesheet' );
However, this doesn’t enqueue the script for the password reset page.
Does anyone know how to customize the password reset page?
Update just to clarify –
The style sheet loads on the wp-login.php page:
http://dev.yazminmedia.com/tresstank/wp-login.php
On the “Lost Your Password” page, it does not load:
http://dev.yazminmedia.com/wp-login.php?action=lostpassword
1 Answer
Your code works fine just the way you have it – I tried it. Maybe you have another plugin that unhooks existing login_enqueue_scripts
hooks disabling yours?
Otherwise it works provided:
- The code is in a plugin;
- style-login.css file is in the same directory as the plugin;
- Some WP CSS uses
!important
; such asbody{ background }
. So,
you’ll need!important
for your CSS properties to override WP.
UPDATE 02/07/16:
Your updated information makes a really big difference!
The code will only work as desired on a WP single site install, not multisite. You have a multisite install using subfolders.
Notice the links in your updated question:
http://dev.yazminmedia.com/tresstank/wp-login.php
http://dev.yazminmedia.com/wp-login.php?action=lostpassword
The password reset link points to your main site not the tresstank
subsite.
It’s not a plugin conflict issue, it’s a WP redirect issue.
Try this link: http://yazmin.bkstest.com/wp-login.php then click on “Lost your password?”. It will not redirect to the main site and the login style will still be applied because I use the code that can be found here https://gist.github.com/eteubert/293e07a49f56f300ddbb to change the default WP behavior. It’s a must have for multisites. It solves issues with links in the password reset emails pointing the user to the main site (where they can’t login) instead of the subsite they are a member of.
If you add the code from the above gist to your plugin your problem will most likely be solved. It works great on subdomain setups but I haven’t tested it with subfolder installs.
NOTE: The code from the gist should be placed in a network activated plugin.