Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#36640 new enhancement

Customize: get_custom_logo should allow the image tag to be filtered independently

Reported by: achbed Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5
Component: Customize Keywords: has-patch
Focuses: Cc:
PR Number:


To allow for further customization of the image tag used in the custom logo, I propose adding a get_custom_logo_img filter to get_custom_logo. This will allow for cleaner modification of the a tag content.

This would be useful in optionally adding accessibility on the image and other content within the home link.

Attachments (2)

custom-logo-img_filter.patch (1.0 KB) - added by achbed 3 years ago.
custom-logo-imgattr_filter.patch (1.1 KB) - added by achbed 3 years ago.
Alternate: Filter for the attributes only instead of the entire img tag

Download all attachments as: .zip

Change History (4)

#1 @westonruter
3 years ago

  • Keywords has-patch added
  • Version changed from trunk to 4.5

Giving more control over the generation of the img markup makes sense, but we'd want to make sure that custom-logo-link class is always includes as otherwise the selective refresh selector will fail to match. Well, I suppose we could still allow it to be changed, but the plugin that filters get_custom_logo_img should also make sure it updates $wp_customize->selective_refresh->get_partial( 'custom_logo' )->selector as required. This should be noted in the filter description.

#2 @achbed
3 years ago

I supposed for accessibility and theming purposes, we could simply allow filtering the image tag attributes. We can then enforce the custom-logo-link class after the filter returns.

3 years ago

Alternate: Filter for the attributes only instead of the entire img tag

Note: See TracTickets for help on using tickets.