wpexpertsio / password-protected

Password protect your WordPress site quickly and simply
https://wordpress.org/plugins/password-protected/
69 stars 63 forks source link

favicon on logging #163

Closed jaywalker29 closed 4 years ago

jaywalker29 commented 4 years ago

Hi there, I've got favicon on my site but standard Wordpress logo shows only in password protect logging screen. I have no experience in PHP but I bet it's pretty simple to make. What lines should I add and where to make my favicon appear even on loggin' screen?

benhuson commented 4 years ago

You should be able to add something like this to your theme's functions.php file. Change "/favicon.ico" to a link to your favicon image if it is named differently.

function my_password_protected_favicon() {
    echo '<link rel="shortcut icon" href="/favicon.ico">';
}
add_action( 'password_protected_login_head', 'my_password_protected_favicon' );
benhuson commented 4 years ago

Or the following may work in WordPress 4.3+?

add_action( 'password_protected_login_head', 'wp_site_icon', 99 );

benhuson commented 4 years ago

Fix in https://github.com/benhuson/password-protected/commit/850cd0dee16b3b2bcbc1eedef28ce1690ec10d5d

Will be in next release.