[wp-trac] [WordPress Trac] #58197: $blog_id always returns 0 in get_site_icon_url hook
WordPress Trac
noreply at wordpress.org
Wed Apr 26 15:59:50 UTC 2023
#58197: $blog_id always returns 0 in get_site_icon_url hook
--------------------------+-----------------------------
Reporter: revxx14 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 6.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I recently tried to set up a default site icon, and ran in to an issue
with multisites. When using the get_site_icon_url hook, like so,
`$blog_id` always returns 0 in a multisite.
{{{#!php
<?php
/**
* Register favicon
*
* @param string $url
* @param integer $size
* @param integer $blog_id
* @return string
*/
function mytheme_set_site_icon_url(string $url, int $size, int $blog_id):
string {
if (get_current_blog_id() === $blog_id) {
return get_theme_file_uri("assets/media/logo-
favicon-{$size}x{$size}.svg");
}
return $url;
}
add_filter("get_site_icon_url", "mytheme_set_site_icon_url", 10, 3);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58197>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list