apply_filters( 'get_custom_logo', string $html, int $blog_id )

Filters the custom logo output.


Description Description


Parameters Parameters

$html

(string) Custom logo HTML output.

$blog_id

(int) ID of the blog to get the custom logo for.


Top ↑

Source Source

File: wp-includes/general-template.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
4.6.0 Added the $blog_id parameter.
4.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content

    If you test your site with Google’s Structured data testing tool you will get an error about itemprop “logo” not being recognized by google as a WP Header element.
    Here is how you remove itemprop

    add_filter( 'get_custom_logo', 'wecodeart_com' );
    // Filter the output of logo to fix Googles Error about itemprop logo
    function wecodeart_com() {
    	$custom_logo_id = get_theme_mod( 'custom_logo' );
    	$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
                esc_url( home_url( '/' ) ),
                wp_get_attachment_image( $custom_logo_id, 'full', false, array(
                    'class'    => 'custom-logo',
                ) )
            );
    	return $html;	
    }

You must log in before being able to contribute a note or feedback.