I did something a little different. I modified the code to look at a specific folder depending on the URL of the site. off of root WP folder I created a favicon folder with the FQDN names as subfolders. I then modified the code like this
function network_favicon() {
$ADVSite_URL = site_url();
$ADVNSite_URL = network_site_url();
$ADVFavIcon = $ADVNSite_URL.'favicon/'.trim($ADVSite_URL, 'https://');
$ADVFavIcon2 = ABSPATH.'favicon/'.trim($ADVSite_URL, 'https://');
$template = get_bloginfo('stylesheet_directory');
$dir = get_stylesheet_directory();
if( file_exists($ADVFavIcon2 . '/favicon.ico') ) {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.$ADVFavIcon.'/favicon.ico" />';
} elseif( file_exists($ADVFavIcon2 . '/favicon.png') ) {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.$ADVFavIcon.'/favicon.png" />';
} elseif( file_exists($ADVFavIcon2 . '/favicon.gif') ) {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.$ADVFavIcon.'/favicon.gif" />';
}
}
I know ADV in the variable names… it’s something I got used to doing years ago to minimize stepping on other global variables. It has nothing to do with vanity ??