[wp-trac] [WordPress Trac] #46124: Allow setting custom image alt text in custom header image

WordPress Trac noreply at wordpress.org
Tue Jan 29 11:27:10 UTC 2019


#46124: Allow setting custom image alt text in custom header image
--------------------------+------------------------------
 Reporter:  webmandesign  |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  5.0.3
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  accessibility
--------------------------+------------------------------

Comment (by webmandesign):

 Hi @mukesh27,

 Thank you. In that case, if there is no need for this backwards
 compatibility, your solution is much better. I think you don't even have
 to set `$alt` variable, you could just use `'alt' => (string)
 get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true
 );`

 However, please note that as it is possible to filter the image URL via
 `get_header_image()`, in my solution I also check if the image is actually
 the one that should have the alt text - see
 [https://core.trac.wordpress.org/attachment/ticket/46124/ticket46124.diff
 lines 1096 to 1101 in my patch].

 Could someone from core team provide feedback if this is OK please?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46124#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list