[wp-trac] [WordPress Trac] #42807: Add filter to modfiy wp.api versionString

WordPress Trac noreply at wordpress.org
Thu Feb 1 22:23:44 UTC 2018


#42807: Add filter to modfiy wp.api versionString
--------------------------+------------------------------
 Reporter:  mkaz          |       Owner:  adamsilverstein
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  javascript
--------------------------+------------------------------

Comment (by jnylen0):

 I think adding a low-level filter is a much more heavyweight approach than
 needed here.

 A cleaner way to resolve this issue is outlined by #41549 and #41554.  The
 idea is to introduce a single client-side code path for all API requests.
 Requests would be sent like `wp.apiRequest( { namespace, path } )`, and
 the function that builds the full API URL can be overridden if needed.

 Similar functionality on the server side is already available through
 filters that modify the behavior of `rest_do_request`.

 It would be pretty difficult to change the WP.com API structure at this
 point, and I think there's general value in adding flexibility in the way
 WordPress makes API calls.

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


More information about the wp-trac mailing list