0

I am trying to change the logo link of my wordpress website. But I am unable to achieve it. I am using child theme and using the code.

function crunchify_custom_logo_url ( $crunchify_logo_html ) {
 
    $crunchify_custom_logo_id = get_theme_mod( 'custom_logo' );
 
    // Make sure to replace your updated site URL
    $crunchify_new_url = 'https://demystifytravel.com/home/';
 
    $crunchify_logo_html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
        esc_url( $crunchify_new_url ),
        wp_get_attachment_image( $crunchify_custom_logo_id, 'full', false, array(
            'class'    => 'custom-logo',
        ) )
    );
    return $crunchify_logo_html;
}
 
add_filter( 'get_custom_logo',  'crunchify_custom_logo_url' );

This code is not giving the error but its not working as it should. Any help where I am going wrong.

1 Answer 1

0

Try to do some debugging, parent theme may be causing this issue, especially if your code is not showing errors.

Remove the parent filter get_custom_logo https://developer.wordpress.org/reference/functions/remove_filter/

If you filter works then it could be sign of priority issue.

$priority (int) (Optional) Used to specify the order in which the functions associated with a particular filter are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the filter. Default value: 10

https://developer.wordpress.org/reference/functions/add_filter/

1
  • Another filter is a good idea, but I'm not sure you'd find that by debugging? It'd be easier to just search the theme files for get_custom_logo and the_custom_logo, to see if they filter is being overridden and that the theme is using this custom logo in the first place.
    – Rup
    Commented Mar 8, 2022 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.