WordPress custom Login page

Hi All,

I used this code to customize the WordPress login page by changing the logo and background image.

I need to know if this code has an error? Because the part for the style code is not highlighted in the text editor, it is blank and inactive.


/*Change Logo & Background*/

if ( ! defined( 'ABSPATH' ) ) {

function wp_loginpage_logo_and_background() { ?>
	.login {
		background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(
			http://website.com/wp-content/uploads/2022/04/background-image.png; /*link to background image*/
			background-size: cover;
			background-position: center;
    		background-repeat: no-repeat;
    		background-attachment: fixed;
			transition: background 0.5s linear;
	#loginform {
  		border-radius: 8px;
		box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
        #login h1 a, .login h1 a {
        	background-image: url(http://website.com/wp-content/uploads/2022/03/logo-image.png; /*link to logo image*/
			background-size: 320px 114px;
			background-repeat: no-repeat;
			padding-bottom: 30px; 
	.login #nav a, .login #backtoblog a {
		color: silver !important;
	.login #nav a:hover, .login #backtoblog a:hover {
		color: whitesmoke !important;
	.login h1 a #logo-text {
		display: none;
 <?php }

add_action( 'login_enqueue_scripts', 'wp_loginpage_logo_and_background' );

function wp_loginpage_logo_and_background_url() {
    return home_url();
add_filter( 'login_headerurl', 'wp_loginpage_logo_and_background_url' );

Thank you,

Where’s the closing bracket to the url?

There are a couple of those missing.

It should be this:

http://website.com/wp-content/uploads/2022/04/background-image.png); /*link to background image*/

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.