WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 6 months ago

#38942 new enhancement

New filter for header image tag attributes

Reported by: junaidbhura Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Themes Keywords: has-patch
Focuses: template Cc:

Description

There is currently no way to filter the attributes of the header image tag before it is used to build the header image tag HTML in the get_header_image_tag() function.

I've attached a diff to solve this problem by adding a new 'get_header_image_tag_attributes' filter.

Attachments (1)

38942.diff (627 bytes) - added by junaidbhura 12 months ago.

Download all attachments as: .zip

Change History (7)

@junaidbhura
12 months ago

#1 @junaidbhura
12 months ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by junaidbhura. View the logs.


11 months ago

This ticket was mentioned in Slack in #core-themes by junaidbhura. View the logs.


6 months ago

#4 follow-up: @obenland
6 months ago

I'm not sure a filter is really needed here since the function accepts an array of attributes that override any defaults. Am I missing something?

#5 in reply to: ↑ 4 @junaidbhura
6 months ago

Replying to obenland:

I'm not sure a filter is really needed here since the function accepts an array of attributes that override any defaults. Am I missing something?

The idea is to have this work similar to wp_get_attachment_image_attributes . There is currently no way to modify the header image's attributes like a normal attachment image.

There is a get_header_image_tag filter, but that is applied after the image's HTML has already been built.

This ticket was mentioned in Slack in #core-themes by junaidbhura. View the logs.


6 months ago

Note: See TracTickets for help on using tickets.