I wanted to replace the wordpress logo which is displayed on login screen with some custom text.

Here is the code what I tried so far:

function my_custom_logo() {
echo '<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/wp-logo.png) !important; }';
add_action('admin_head', 'my_custom_logo');

It can replace the logo but what should I need to replace it with some text? Any suggestions to make it work?


4 Answers 4


You will first need to remove the wordpress logo from the login screen. The wordpress logo is added by css, so you will need to change the css and hook that to the login_enqueue_scripts action hook

function my_login_logo() { ?>
    <style type="text/css">
        body.login div#login h1 a {
            background-image: none;
            background-size: 0 0;
            height: 0;
            margin: 0 auto 0;
            width: 0;
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

Next you can add your custom message

function custom_login_message() {
$message = "Your custom message goes here";
return $message;
add_filter('login_message', 'custom_login_message');

You can go and have a look at the codex for additional hooks and filters for the login form

  • This uses the login message field which could be used for other text and resides OUTSIDE the h1 tags. Ideally you would want this to appear INSIDE the tags so that you could otherwise use CSS to format the text in a unique way and not affect the message field should it be used for whatever reason.
    – Madivad
    Dec 12, 2014 at 2:24

It really depends on what text you want to replace it with.

For example: if you want to replace it with the blog title, then believe it or not, it is VERY simple and can be done through CSS alone.

The blog title already appears in the image, but it's been shifted offscreen by text-indent and all is required is to return it to normal.

.login h1 a {
    text-indent: 0;
    background-image: url('');
    background-size: auto;
    width: auto;
    color: #fff;
    font-size: 1.5em;

Setting the URL to '' removes it, in the event you want to totally get rid of the background image. Set colour and size as necessary.


The logo is written into the CSS and the link text and target are filterable:

    105         /**
    106          * Filter link URL of the header logo above login form.
    107          *
    108          * @since 2.1.0
    109          *
    110          * @param string $login_header_url Login header logo URL.
    111          */
    112         $login_header_url = apply_filters( 'login_headerurl', $login_header_url );
    113         /**
    114          * Filter the title attribute of the header logo above login form.
    115          *
    116          * @since 2.1.0
    117          *
    118          * @param string $login_header_title Login header logo title attribute.
    119          */
    120         $login_header_title = apply_filters( 'login_headertitle', $login_header_title );


For example:

function alter_login_headerurl() {
  return 'http://example.com';

function alter_login_headertitle() {
  return 'Yay';

To alter the image enqueue a login stylesheet and override the background image on .login h1 a.


It's simple

function my_custom_logo() {
echo '<script>jQuery("#header-logo").html("<h1>My Text Logo</h1>")</script>';
add_action('admin_head', 'my_custom_logo');
  • 2
    Please givge an explanation to why this should work Apr 8, 2014 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.