[wp-trac] [WordPress Trac] #39473: get_routes() called multiple times within single REST request causing the rest_endpoints() filter to also fire more than once

WordPress Trac noreply at wordpress.org
Thu Jan 12 23:53:22 UTC 2023


#39473: get_routes() called multiple times within single REST request causing the
rest_endpoints() filter to also fire more than once
-------------------------------------------------+-------------------------
 Reporter:  ruud@…                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  REST API                             |     Version:  4.4
 Severity:  normal                               |  Resolution:
 Keywords:  needs-refresh needs-unit-tests       |     Focuses:
  good-first-bug                                 |
-------------------------------------------------+-------------------------

Comment (by mreishus):

 I'm happy to revive this; `get_routes()` in the meantime now has a
 parameter: `get_routes( $route_namespace )`. I came up with an idea in the
 attached patch above, but it doesn't feel quite right. Any ideas?

 This patch also doesn't solve the problem of `get_routes()` being called
 more than once, because the `$route_namespace` optimization was applied to
 the main callsite of `get_routes()`, but not the others. But that could be
 tackled as a second step.

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


More information about the wp-trac mailing list