admin管理员组

文章数量:1300023

I want to write a plugin that uses the Wordpress5 methods of embedding media. I want a block where users can insert URLs. Then use WordPress methods to find the provider and get the embeddable iframe.

Like you post a url from e.g. youtube, twitter to your post and you get an iframe with the embedded video, also determine if it is a valid youtube url. I do not want to use other plugins.

From browsing the gutenberg code. I found that the embed blocks use the oembed api. However I fail at sending requests to the /wp-json/oembed/1.0/proxy as well as the /wp-json/oembed/1.0/embed endpoint.

From the gutenberg test source I assume that it should return json with the iframe html and the provider.

How, if at all, can I use that api endpoint?

本文标签: embedJSON api oembed youtube