[wp-trac] [WordPress Trac] #39696: REST API: Filter which links get embedded when passing the ?_embed query parameter

WordPress Trac noreply at wordpress.org
Fri Jan 27 20:11:14 UTC 2017


#39696: REST API: Filter which links get embedded when passing the ?_embed query
parameter
-------------------------------------------------+-------------------------
 Reporter:  rheinardkorf                         |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  REST API                             |  Review
 Severity:  normal                               |     Version:  4.7.1
 Keywords:  2nd-opinion needs-refresh needs-     |  Resolution:
  unit-tests                                     |     Focuses:  rest-api
-------------------------------------------------+-------------------------
Changes (by adamsilverstein):

 * keywords:   => 2nd-opinion needs-refresh needs-unit-tests


Comment:

 Hi @rheinardkorf. Welcome to trac and thanks for your ticket and patch!

 This seems like a nice enhancement. I tested the patch and verified it
 works as expected. However, I am concerned about using the `_embed`
 parameter to specify the fields. The [https://developer.wordpress.org
 /rest-api/using-the-rest-api/global-parameters/#embed API docs on using
 _embed] mention that you can pass nothing or "1" to enable embed data, and
 with your patch "1" no longer works.

 [[Image(https://cl.ly/3t0Z3O3y0Q1R/Global_Parameters__REST_API_Handbook__WordPress_Developer_Resources_2017-01-27_14-57-41.jpg)]].

 Can you try adding a new parameter to define the embed resources you want
 to be returned?

 In regard to adding unit tests, you could probably add tests in
 `tests/phpunit/tests/rest-api/rest-posts-controller.php` verifying that
 the embed parameter and your filtering works as expected, take a look
 there and let me know if you have any questions.

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


More information about the wp-trac mailing list