Opened 7 years ago
Last modified 5 years ago
#41554 new enhancement
REST API: Use `wp.apiRequest` helper to build URLs for media embed requests
Reported by: | jnylen0 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | good-first-bug has-patch |
Focuses: | javascript, administration, rest-api | Cc: |
Description
Follow-up to #40919.
Let's explore getting rid of the oEmbedProxyUrl
property used to pass a REST API URL down to wp-admin
code that calls out to this endpoint (example). We can use the helper library introduced in #40919 instead:
wp.apiRequest( { namespace: 'oembed/1.0', path: '/proxy', // ... } );
This helper will allow us to eliminate all rest_url
calls passed to client code through script localization. This will eventually lead to a lot of duplication, but it seems like it should be very clear from the requesting code which API endpoint is being called.
Attachments (2)
Change History (4)
Note: See
TracTickets for help on using
tickets.
I have done the path a described above. How can I test this actually? I tried by embedding a Youtube video, but I don't think it uses the action that got modified.