WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 13 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 3 years ago.

Download all attachments as: .zip

Change History (8)

@junaidbhura
3 years ago

#1 @junaidbhura
3 years ago

  • Keywords has-patch added

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


3 years ago

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


2 years ago

#4 follow-up: @obenland
2 years 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
2 years 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.


2 years ago

This ticket was mentioned in Slack in #themereview by joyously. View the logs.


13 months ago

Note: See TracTickets for help on using tickets.