[wp-trac] [WordPress Trac] #39092: REST API: Add support for filename search in media endpoint

WordPress Trac noreply at wordpress.org
Tue Dec 6 02:15:59 UTC 2016


#39092: REST API: Add support for filename search in media endpoint
-------------------------------------------------+-------------------------
 Reporter:  jblz                                 |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  REST API                             |  Review
 Severity:  normal                               |     Version:  trunk
 Keywords:  has-patch needs-unit-tests needs-    |  Resolution:
  testing                                        |     Focuses:  rest-api
-------------------------------------------------+-------------------------

Comment (by joemcgill):

 I think including attachment filenames in the REST API is a good idea, as
 I assume at some point we'll likely want to use the REST API to drive
 search experiences for media rather than relying on the admin-ajax
 handlers. Thanks for the suggestion and patch @jblz.

 A few comments on [attachment:39092.diff]:

 First, I agree with @jnylen0 that adding `alt` to search should be handled
 in a separate ticket. Conveniently, that ticket already exists, see:
 #39004.

 Also, It looks like by adding the filter to
 `WP_REST_Posts_Controller::get_items()`, the extra JOINs would get added
 to all search queries and not just attachment search queries. Is that
 correct? While the code looks identical to the other places where the
 filter is added, we're only adding that filter within functions that only
 apply to attachment searches within the admin. I'm not sure if adding some
 sort of admin context to the REST endpoints makes sense here, but limiting
 this so the extra joins don't affect regular search queries would be good.

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


More information about the wp-trac mailing list