WordPress login changes after update

55 Views Asked by At

I made changed to login page (css, logo, etc.), and it all worked fine, but I have a problem with it because it all resets each time WordPress is updated to a newer version.

Is there way to prevent this from happening, or do I need to reapply the changes each time?

1

There are 1 best solutions below

1
On BEST ANSWER

The biggest question to ask yourself is, where are you putting in your overrides?

The best way to override this is with a function that lives in either a custom plugin or your theme that is not tied to the Core. If you are editing the core CSS (for admin) then yes it will be overridden.

Here's my go-to function set:

//customize login screen
function login_styles() {
    echo '<style type="text/css">body {background: white url(' . get_bloginfo("template_directory") . '/assets/img/background.png) !important; }.login h1 a {background-image: url(' . get_bloginfo("template_directory") . '/assets/img/your-site-logo.png) !important;background-size: 100% auto;height: 100px !important;width: 310px !important;}</style>';
}

add_action('login_head', 'login_styles');

function loginpage_custom_link() {
    return 'http://yourwebsite.com';
}

add_filter('login_headerurl', 'loginpage_custom_link');

function change_title_on_logo() {
    return 'Your Website Name';
}

add_filter('login_headertitle', 'change_title_on_logo');