On this page
has_custom_logo( int $blog_id ): bool
Determines whether the site has a custom logo.
Parameters
$blog_idint Optional-
ID of the blog in question. Default is the ID of the current blog.
Return
bool Whether the site has a custom logo or not.
Source
File: wp-includes/general-template.php. View all references
function has_custom_logo( $blog_id = 0 ) {
$switched_blog = false;
if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
switch_to_blog( $blog_id );
$switched_blog = true;
}
$custom_logo_id = get_theme_mod( 'custom_logo' );
if ( $switched_blog ) {
restore_current_blog();
}
return (bool) $custom_logo_id;
}
Related
Uses
| Uses | Description |
|---|---|
| get_theme_mod() wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| switch_to_blog() wp-includes/ms-blogs.php | Switch the current blog. |
| restore_current_blog() wp-includes/ms-blogs.php | Restore the current blog, after calling switch_to_blog() . |
| is_multisite() wp-includes/load.php | If Multisite is enabled. |
| get_current_blog_id() wp-includes/load.php | Retrieve the current site ID. |
Used By
| Used By | Description |
|---|---|
| get_body_class() wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
Changelog
| Version | Description |
|---|---|
| 4.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/has_custom_logo