[wp-trac] [WordPress Trac] #45605: REST API: Avoid DB queries from generating sample permalink when possible

WordPress Trac noreply at wordpress.org
Wed Jan 9 16:10:48 UTC 2019


#45605: REST API: Avoid DB queries from generating sample permalink when possible
--------------------------+---------------------
 Reporter:  dlh           |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.1
Component:  REST API      |     Version:  5.0
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------

Comment (by RogerTheriault):

 Replying to [comment:6 TimothyBlynJacobs]:
 > I think adding something like this to
 `WP_REST_Controller::get_fields_for_response()` makes sense.
 >
 >

 I tested that with the requests I was cxoncerned about, e.g. `k/wp-
 json/wp/v2/posts?_embed=true`


 Happy to say the `get_sample_permalink()` code was not being executed for
 those requests.


 > > Is the third parameter for get_sample_permalink() necessary here?...
 >
 > This was introduced here:
 https://github.com/WordPress/gutenberg/commit/3d93ac6a2f60fa98a599196785f25a68b9997c12

 Thanks. It seems like that may have been overly broad.

 I think this fix will help, hopefully it has no adverse effect on other
 requests.

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


More information about the wp-trac mailing list