[Resolved] Site Logo Alt Tag Filter

Home Forums Support Site Logo Alt Tag Filter

  • This topic has 3 replies, 2 voices, and was last updated 1 year ago by Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1232338

    Hello Tom,

    I found you posted this code to adjust the Site Logo alt tag independently from the Site Title given in customizer:

    add_filter( 'generate_logo_title', 'tu_adjust_logo_alt' );
    function tu_adjust_logo_alt() {
        return 'Reclaim Design Logo';

    I’ve added this and what happens is that it changes the site link title text as well:


    How can I set the filter to only add alt tag for the image and keep the site link title as it is set in Customizer?

    So <a href="https://reclaimdesign.org/" title="Reclaim Design" rel="home"> instead of <a href="https://reclaimdesign.org/" title="Reclaim Design Logo" rel="home"> (as it’s getting set to when the filter is applied)?

    Thank you for your help πŸ™‚


    Lead Developer
    Lead Developer

    Hi there,

    You can do this:

    add_filter( 'generate_logo_output', function( $output, $logo_url, $html_attr ) {
    		'<div class="site-logo">
    			<a href="%1$s" title="Set your title here" rel="home">
    				<img %3$s />
    		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
    		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
    }, 10, 3 );

    You’re the bomb Tom – that works great, thank you! πŸ™‚

    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.