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.