[wp-trac] [WordPress Trac] #60922: get_custom_logo returns an empty link when no logo image is set

WordPress Trac noreply at wordpress.org
Thu Apr 4 13:02:46 UTC 2024


#60922: get_custom_logo returns an empty link when no logo image is set
---------------------------+-----------------------------
 Reporter:  afercia        |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:
 Severity:  normal         |   Keywords:
  Focuses:  accessibility  |
---------------------------+-----------------------------
 When a custom logo image is not set, `get_custom_logo()` returns an empty
 link regardless.

 Empty links are far from ideal for SEO and accessibility and should be
 avoided.

 Example of the returned HTML:

 {{{
 <a href="http://localhost:8889/" class="custom-logo-link" rel="home"></a>
 }}}


 With the Site Logo block of the editor, the HTML would be:


 {{{
 <div class="wp-block-site-logo">
     <a href="http://localhost:8889/" class="custom-logo-link"
 rel="home"></a>
 </div>
 }}}

 where the link markup comes from `get_custom_logo()`

 To reproduce:
 - Use Twenty Twent-Four as active theme.
 - Go to the site editor, edit the Blog Home template.
 - Select the Site Logo block. Add it if necessary.
 - Do not set a logo image, leave the block empty and save.
 - Go to the front end.
 - Inspect the source and observe the site logo link is an empty link.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60922>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list