WordPress at a glance

has_custom_logo() WP 1.0

Determines whether the site has a custom logo.

Works based on: get_theme_mod()
✈ 1 time = 0.000037s = very fast | 50000 times = 0.59s = very fast PHP 7.0.5, WP 4.5

No Hooks.

Return

true/false. Whether the site has a custom logo or not.

Usage

has_custom_logo( $blog_id );
$blog_id(int)
ID of the blog in question.
Default: ID of the current blog

Code of has_custom_logo: wp-includes/general-template.php VER 4.9.8

<?php
function has_custom_logo( $blog_id = 0 ) {
	$switched_blog = false;

	if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_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 Functions

From tag: custom_logo

More from category: Other Theme Functions

No comments
    Hello, !     Log In . Register