WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 6 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 11 months ago.
39004.1.patch (1.0 KB) - added by rommelxcastro 11 months ago.
fixes query
39004.2.patch (2.0 KB) - added by rommelxcastro 11 months ago.
function name refactor

Download all attachments as: .zip

Change History (16)

#1 @joedolson
11 months ago

See #22744 as a model for doing this.

#2 @joedolson
11 months ago

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

#3 @joedolson
11 months 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
11 months ago

  • Milestone changed from Awaiting Review to 4.8

#5 @rommelxcastro
11 months 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
11 months ago

fixes query

@rommelxcastro
11 months ago

function name refactor

#6 @rommelxcastro
11 months 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
11 months ago

  • Keywords needs-unit-tests added

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


10 months ago

#9 @joemcgill
10 months ago

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

#10 @joemcgill
10 months 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.


9 months ago

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


6 months ago

#13 @joemcgill
6 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.

Note: See TracTickets for help on using tickets.