Changing the WordPress Login Logo without Using a Plug-in
Wordpress

Changing the WordPress Login Logo without Using a Plug-in

2023-02-25 · 3 分鐘 · Ray Lee (System Analyst)

Although there are numerous WordPress plugins that enable you to change your login logo (which defaults to the cute WordPress logo), you may prefer to customize it yourself, as I do. In this tutorial, we will walk through how to override the CSS to modify the login logo.

Changing the WordPress Login Logo without Using a Plug-in

Default login page.

First of all, You need to prepare an image that size is bigger than 64 x 64. Then upload it into media.

Changing the WordPress Login Logo without Using a Plug-in
Upload it into media library
[Your WordPress Directory]/wp-includes/functions.php 

Open the function.php file and add the following code to the bottom line. Note that you need to replace the image URL with the URL of your logo.

function custom_login_logo() {
    echo '<style type="text/css">
        .login h1 a {
            background-image: url(https://www.ninniku.tw/wp-content/uploads/2023/02/icons8-pug-96.png) !important;
            background-size: contain !important;
            width: 300px !important;
        }
    </style>';
}
add_action('login_head', 'custom_login_logo');
Changing the WordPress Login Logo without Using a Plug-in

Success! We have done it.

English Version

Although there are numerous WordPress plugins that enable you to change your login logo (which defaults to the cute WordPress logo), you may prefer to customize it yourself, as I do. In this tutorial, we will walk through how to override the CSS to modify the login logo.

Changing the WordPress Login Logo without Using a Plug-in

Default login page.

First of all, You need to prepare an image that size is bigger than 64 x 64. Then upload it into media.

Changing the WordPress Login Logo without Using a Plug-in
Upload it into media library
[Your WordPress Directory]/wp-includes/functions.php 

Open the function.php file and add the following code to the bottom line. Note that you need to replace the image URL with the URL of your logo.

function custom_login_logo() {
    echo '<style type="text/css">
        .login h1 a {
            background-image: url(https://www.ninniku.tw/wp-content/uploads/2023/02/icons8-pug-96.png) !important;
            background-size: contain !important;
            width: 300px !important;
        }
    </style>';
}
add_action('login_head', 'custom_login_logo');
Changing the WordPress Login Logo without Using a Plug-in

Success! We have done it.

日本語版

WordPressのログインロゴ(デフォルトではおなじみのWordPressロゴ)を変更できるプラグインは数多くありますが、私のように自分でカスタマイズしたい方もいるでしょう。このチュートリアルでは、CSSをオーバーライドしてログインロゴを変更する方法を解説します。

Changing the WordPress Login Logo without Using a Plug-in

デフォルトのログインページ

まず、64 x 64ピクセルより大きいサイズの画像を準備します。その後、メディアライブラリにアップロードしてください。

Changing the WordPress Login Logo without Using a Plug-in
メディアライブラリにアップロード
[Your WordPress Directory]/wp-includes/functions.php 

function.phpファイルを開き、以下のコードを最終行に追加します。画像URLを自分のロゴのURLに置き換える必要がありますのでご注意ください。

function custom_login_logo() {
    echo '<style type="text/css">
        .login h1 a {
            background-image: url(https://www.ninniku.tw/wp-content/uploads/2023/02/icons8-pug-96.png) !important;
            background-size: contain !important;
            width: 300px !important;
        }
    </style>';
}
add_action('login_head', 'custom_login_logo');
Changing the WordPress Login Logo without Using a Plug-in

成功です!完了しました。

Ray Lee (System Analyst)
作者 Ray Lee (System Analyst)

iDempeire ERP Contributor, 經濟部中小企業處財務管理顧問 李寶瑞