I need to change default WordPress get_custom_logo()
generated url because I need to link to the main multi-site site instead of single site. Is there any filter to change this function?
2 Answers
I solved using this filter:
add_filter( 'get_custom_logo', 'custom_logo_url' );
function custom_logo_url ( $html ) {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$url = network_site_url();
$html = sprintf( '<a href="https://wordpress.stackexchange.com/questions/232174/%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
esc_url( $url ),
wp_get_attachment_image( $custom_logo_id, 'full', false, array(
'class' => 'custom-logo',
) )
);
return $html;
}