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 = '/';
$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.
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.
Share Improve this question asked Mar 6, 2022 at 15:35 Arbab AliArbab Ali 11 Answer
Reset to default 0Try 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/