I am trying to change the href of the logo to a specific custom URL other than the homepage for checkout page.

I have tried few methods including the one shown below but did not work :

add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
if  ( is_checkout()) {
        return 'https://www.custom.de/customurl';
    else {
    return 'https://www.custom.de/';

This is the block of the logo. I am trying to change the href associated with the anchor tag :

    <div id="logo" class="flex-col logo"> <!-- Header logo -->
    <a href="https://custom.com" title="Title" rel="home">
        <img width="213" height="89" src="https://custom/wp-content/uploads/2019/09/Logo1.svg" class="header_logo header-logo" alt="text">
        <img width="213" height="89" src="https://custom/wp-content/uploads/2019/09/Logo2.svg" class="header-logo-dark" alt="text">


Is there any other hooks specifically for this purpose? I am using flatsome theme.

  • 1
    It depends on how your theme adds the link to begin with. There's preferred ways, but there's no guarantee your theme used them. You should contact the theme author. Apr 23 '20 at 15:31
  • If you want to change the behaviour of a theme, the recommended way is to create a child theme. Have you looked into this yet? Apr 23 '20 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.