Conditional Logic to Check for Site Icon

There exists a special function to check if the site icon is set, namely the has_site_icon() function.

So you could try:

add_action( 'wp_head',    'wpse_default_site_icon', 99 );
add_action( 'login_head', 'wpse_default_site_icon', 99 );

function wpse_default_site_icon()
{
    if( ! has_site_icon()  && ! is_customize_preview() )
    {
        // your default icons here
    }
} 

The case when the site icon is set, is already handled by:

add_action( 'wp_head',    'wp_site_icon',  99    );
add_action( 'login_head', 'wp_site_icon',  99    );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)