has_custom_logo

Determines whether the site has a custom logo.

Description

has_custom_logo( (int) $blog_id = 0 ); 

Parameters (1)

0. $blog_id — Optional. (int)
ID of the blog in question. Default is the ID of the current blog.

Usage

  1. if ( !function_exists( 'has_custom_logo' ) ) { 
  2. require_once ABSPATH . WPINC . '/general-template.php'; 
  3.  
  4. // Optional. ID of the blog in question. Default is the ID of the current blog. 
  5. $blog_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = has_custom_logo($blog_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/general-template.php  
  1. function has_custom_logo( $blog_id = 0 ) { 
  2. $switched_blog = false; 
  3.  
  4. if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) { 
  5. switch_to_blog( $blog_id ); 
  6. $switched_blog = true; 
  7.  
  8. $custom_logo_id = get_theme_mod( 'custom_logo' ); 
  9.  
  10. if ( $switched_blog ) { 
  11.  
  12. return (bool) $custom_logo_id;