request hook for oEmbeds? – WordPress Development Stack Exchange

Question

When I try to oEmbed my own links, or try to oEmbed links from my own site on other sites, the oEmbed fails with the unhelpful message “This content can not be included”.

When I check the headers of my pages, they contain an oEmbed reference, like so:

https://{{my site}}/wp-json/oembed/1.0/embed?url={{my page's encoded URL}}

When I visit this URL, I get this:

{"code":"oembed_invalid_url","message":"Not Found","data":{"status":404}}

For returning the correct content in the frontend, in order to avoid conflicting permalinks between different content types (which have the same permalink structure), I hook into the request hook, like so:

add_filter( 'request', 'my_parse_request' );

I guess that, when requesting the oEmbed for a particular link, this request hook is not fired, and the requested article can not be found by the oEmbed.

So, I suppose my question is, how do have ‘my_parse_request’ also run when requesting the oEmbed for an article on my site?

0
MastaBaba 2 years 2021-05-01T15:20:19-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse