Add Custom Logo URL

This is a developer-level article. If you’re unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from our support for small changes.

By default, the logo on your website will lead users to your homepage. If you wish to alter/change the URL of the logo in your header, use the following PHP snippet:

// Add custom logo URL
function prefix_custom_logo_link() {
        // The logo
    $custom_logo_id = get_theme_mod( 'custom_logo' );

    // Check if has logo
    if ( $custom_logo_id ) {

        // Attr
            $custom_logo_attr = array(
                        'class' => 'custom-logo',
                        'itemprop' => 'logo',

                // Image alt
                $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
                if ( empty( $image_alt ) ) {
                        $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );

            // Get the image
            $html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
                        esc_url( '' ),
                        wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr )


        // Return
    return $html;   
add_filter( 'get_custom_logo', 'prefix_custom_logo_link' );

Change per your need.

All PHP snippets should be added via a child theme’s functions.php file.

Subscribe to our newsletter

Get tips, news, gifts and exclusive promotions directly to your inbox and be the first to know about the latest updates from us. No spam, we guarantee!


Blazingly fast, lightweight, fully responsive, SEO-ready, and 100% Vanilla JS WordPress Theme

Facebook YouTube

Our Products

Get Help


Copyright © 2024 | Created with Olympus & Olympus Blocks