WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 13 months ago

#39004 accepted enhancement

Alt attributes should be searchable in media library

Reported by: joedolson Owned by: joedolson
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0
Component: Media Keywords: needs-testing needs-unit-tests
Focuses: accessibility, administration Cc:

Description

The alt attribute is intended to be the alternative replacement value for an image. As such, if you're managing an image library correctly, it would be entirely reasonable that most images would have an alt attribute but no caption or description. However, this means that your only searchable field is the image title.

Attachments (3)

39004.patch (1.0 KB) - added by rommelxcastro 2 years ago.
39004.1.patch (1.0 KB) - added by rommelxcastro 2 years ago.
fixes query
39004.2.patch (2.0 KB) - added by rommelxcastro 2 years ago.
function name refactor

Download all attachments as: .zip

Change History (18)

#1 @joedolson
2 years ago

See #22744 as a model for doing this.

#2 @joedolson
2 years ago

  • Owner set to joedolson
  • Status changed from new to accepted

#3 @joedolson
2 years ago

  • Version set to 3.0

Setting version to 3.0; but this has probably been the case from the beginning. I'm just copycatting @johnbillion. ;)

#4 @joedolson
2 years ago

  • Milestone changed from Awaiting Review to 4.8

@rommelxcastro
2 years ago

#5 @rommelxcastro
2 years ago

  • Keywords needs-testing added; needs-patch removed

First patch added, I will add another one since probably the function name needs to be renamed to clarify it doesn't just searches by title

@rommelxcastro
2 years ago

fixes query

@rommelxcastro
2 years ago

function name refactor

#6 @rommelxcastro
2 years ago

  • Keywords 2nd-opinion added

39004.2.patch has the same query as 39004.1.patch, but changes the function name to meta to reflects it searches by meta.

#7 @rommelxcastro
2 years ago

  • Keywords needs-unit-tests added

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


2 years ago

#9 @joemcgill
2 years ago

Take note of #39092. We will probably want to do something similar for this.

#10 @joemcgill
2 years ago

  • Keywords dev-feedback 2nd-opinion removed

Related: #39358. We'll need to be aware of query performance concerns introduced in [38625] / #22744 before finalizing the approach here.

Setting aside performance concerns for the moment, 39004.2.patch looks like a good initial approach. Thanks @rommelxcastro. We may need to handle some backwards compatibility for anyone who has decided to do something like: remove_filter( 'posts_clauses', '_filter_query_attachment_filenames' ); or if someone is calling that function directly to apply the filter to other query cases.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


2 years ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


23 months ago

#13 @joemcgill
23 months ago

  • Milestone changed from 4.8 to Future Release

This, unfortunately, will have to wait until we have a better answer for the query performance concerns brought up in #39358.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


13 months ago

#15 @afercia
13 months ago

@joemcgill willing to own this? :)

Note: See TracTickets for help on using tickets.