I have this in the functions.php:

add_theme_support( 'custom-logo', array(
        'height'      => 200,
        'width'       => 1000,
        'flex-width'  => true,
        'flex-height' => true,
    ) );

and this in my header file:

<div class="site-branding">
        if ( is_front_page() || is_home() ) : ?>
            <h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
        <?php else : ?>
            <p class="site-title"><?php bloginfo( 'name' ); ?></p>

        $description = get_bloginfo( 'description', 'display' );
        if ( $description || is_customize_preview() ) : ?>
            <p class="site-description"><?php echo $description; /* WPCS: xss ok. */ ?></p>
        endif; ?>

The logo links to my home page, and I don't know why. What's causing it to do that? There's no a tag surrounding it. How can I make the logo NOT a link?


Look at the documentation for the_custom_logo():

Displays a custom logo, linked to home.

So it's doing what it's supposed to.

If you want to do anything other than that, you can get the ID of the logo image using get_theme_mod( 'custom_logo' ). Then you can do whatever you want to it, such as just outputting the image:

echo wp_get_attachment_image( get_theme_mod( 'custom_logo' ), 'full' )
| improve this answer | |
  • I figured that the_custom_logo() was doing what it was supposed to, I just needed to know how to make it not do what it's supposed to =] So are you saying I should replace the_custom_logo() in my header file with echo wp_get_attachment_image( get_theme_mod( 'custom_logo' ), 'full' ) ? – Santiago Welbes Sep 18 '17 at 1:33
  • I did what I just asked and it worked! Thank you very much Jacob! – Santiago Welbes Sep 18 '17 at 1:33

Your Answer

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

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