C4f1151075b447779af31e99d6cf70e2c6eb47ac
By:
newbie

replacing wordpress login logo

June 8, 2017 398 views
WordPress Ubuntu 16.04

Hello guy's
i know this is not related to server setup, but i know ill find many expert here who can help me out.

i need to replace the wordpress logo from the wp-login.php

so i added following in my themes function.php

/*** Custom LOGO ***/
add_action( 'login_enqueue_scripts', 'my_login_logo' );

function custom_login_logo() {
    echo '<style type="text/css">'.
             'h1 a { background-image:url('.get_bloginfo( 'template_directory' ).'/assets/my-logo.png) !important; }'.
         '</style>';
}
add_action( 'login_head', 'custom_login_logo' );

it replaces the logo, but whenever i login i get this error massage in my error.log

2017/06/08 17:28:13 [error] 3588#3588: *222 FastCGI sent in stderr: "PHP message: PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'my_login_logo' not found or invalid function name in /var/www/mysite/html/wp-includes/class-wp-hook.php on line 298" while reading response header from upstream, client: 103.205.121.545, server: mysite.com, request: "GET /wp-login.php?redirect_to=https%3A%2F%2Fmysite.com%2Fwp-admin%2F&reauth=1 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "mysite.com"

anyone can guide me here?

2 Answers

@newbie

The issue is with the first add_action function call.

If a function named my_login_logo does not exist in your code, adding an action that would call it will result in the warning or an error.

Looking at the WordPress docs:

https://codex.wordpress.org/Customizing_the_Login_Form

You should use:

function my_login_logo() {
    echo '<style type="text/css">'.
             'h1 a { background-image:url('.get_bloginfo( 'template_directory' ).'/assets/my-logo.png) !important; }'.
         '</style>';
}

add_action( 'login_enqueue_scripts', 'my_login_logo' )

There are a few other examples as well, which includes changing links, further styling, etc.

  • @jtittle
    thanks for the reply that really solved the issue

    i have another one though
    no matter whatever i do, cant get rid of this warning

    2017/06/08 18:25:21 [warn] 5195#5195: *8 an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/2/00/0000000002 while reading upstream, client: 103.205.112.114, server: mysite.com, request: "GET /wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,plupload&ver=4.7.5 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "mysite.com", referrer: "https://mysite.com/wp-admin/"
    2017/06/08 18:25:21 [warn] 5195#5195: *8 an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/3/00/0000000003 while reading upstream, client: 103.205.112.114, server: mysite.com, request: "GET /wp-admin/load-scripts.php?c=0&load%5B%5D=hoverIntent,common,admin-bar,jquery-ui-widget,jquery-ui-position,wp-pointer,wp-ajax-response,jquery-color,wp-lists,quicktags,jqu&load%5B%5D=ery-query,admin-comments,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,postbox,dashboard,underscore,customize-base,customize&load%5B%5D=-loader,thickbox,plugin-install,wp-util,wp-a11y,updates,shortcode,media-upload,svg-painter,heartbeat,wp-auth-check,jquery-ui-dra&load%5B%5D=ggable,jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,backbone,wp-backbone,media-models,wp-plupload,mediaelement,wp-me&load%5B%5D=diaelement,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit&ver=4.7.5 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "mysite.com", referrer: "https://mysite.com/wp-admin/"
    

    i tuned almost all proxy buffers to higher value, but still im getting this whenever i login to my wp-admin :(

@newbie

It shouldn't, no, though ultimately the only way to tell if something is impacting performance is to use a monitor or conduct performance metric testing. If you're not currently seeing higher levels of traffic, it will be a little harder to do that since with low levels of traffic (or no traffic), you can't really tell unless it is something major.

  • @newbie

    Just wanted to follow up and see if that took care of the warnings being logged :-).

    • @jtittle
      hey bro, thanks for following up with this. i havent actually set proxy_max_temp_file_size 0; yet.
      working on some other parts atm, but will let u know the result shortly.

      • @newbie

        No problem, let me know when you have time and we'll take a closer look if that doesn't fix things up!

Have another answer? Share your knowledge.