How to Change Website Logo Destination URL
|
/ Documentation /Custom Code Snippets/Astra Header & Footer Filters/ How to Change Website Logo Destination URL

How to Change Website Logo Destination URL

Your website’s logo isn’t just an image; it’s an important branding tool. Sometimes, you might need to change where your logo takes your website visitors when they click on it.

Whether it’s due to site changes or partnerships, customizing your logo’s destination URL is a smart move.

This guide will walk you through how to change the destination URL for the website logo effortlessly.

What are the Steps to Change Website Logo Destination URL

By following the below-mentioned easy steps, you can effortlessly customize your logo’s URL and take full control of your website’s branding and functionality.

  • Log in to your website’s admin dashboard.
  • Locate and click on “Appearance” in the left-hand menu. Then, select Theme Editor.
  • Select the Astra Child theme from the drop-down and click on Select to choose it.
  • Navigate to the child theme’s functions.php, from the right-hand section by selecting functions.php.
  • Add your below-provided code at the bottom of the file and click on Update File at the bottom.

For users with the Astra theme version below 3.0.0 —

add_action('astra_masthead', 'astra_logo_change_url');

function astra_logo_change_url()
{
remove_action( 'astra_masthead_content', 'astra_site_branding_markup', 8 );
add_filter( 'home_url', 'astra_logo_custom_url' );
add_action( 'astra_masthead_content', 'astra_site_branding_markup', 8 );
}

function astra_logo_custom_url( $url ) 
{
return 'https://google.com';
}
add_action('astra_masthead_content','astra_remove_logo_custom_url',9);
function astra_remove_logo_custom_url()
{
remove_filter( 'home_url', 'astra_logo_custom_url' );
}

For new Users with the Astra theme version 3.0.0 and above, using the Header Footer Builder —

add_action('astra_masthead', 'astra_logo_change_url'); 
add_action('astra_mobile_header_bar_top', 'astra_logo_change_url'); 
function astra_logo_change_url()
{ 
remove_action( 'astra_masthead_content', 'astra_site_branding_markup', 8 ); 
add_filter( 'home_url', 'astra_logo_custom_url' ); 
add_action( 'astra_masthead_content', 'astra_site_branding_markup', 8 ); 
} 
function astra_logo_custom_url( $url ) 
{ 
return 'https://google.com'; 
} 
add_filter('astra_logo','astra_remove_logo_custom_url'); 
function astra_remove_logo_custom_url( $html )
{ 
remove_filter( 'home_url', 'astra_logo_custom_url' ); 
return $html; 
}

Make sure you replace the test URL (http://google.com) with your destination URL in the above code.

You can follow the instructions provided in this document to insert the code into the functions.php file of your child theme.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

This field is required.

REWIND

YEAR IN REVIEW

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form