How to oEmbed MySite in WordPress

Question

Could somebody please help me understand how to debug this and what to do?

In short

I created a oembed provider and added it to wordpress. I see that wordpress got in response the correct json. But there is no further request for the picture at the provided url.

All I know

So basically I have a wordpress site and I want to embed a picture from another site of mine while writing a post.

I added the

wp_oembed_add_provider( 'https://dynamicallyLoadedSPA.com/*', 'https://laravelBackend.com/oembed/', false );

function in the functions.php (in the wordpress site). And after that, now when I paste a link while writing a post the embeding process happens, but still no picture or anything. I don’t know how to debug this.

I see in my nginx logs,

/oembed/?maxwidth=1060&maxheight=1000&url=https://dynamicallyLoadedSPA.com/some-link-with-picture-and-description&dnt=1&format=json

that wordpress did make a request to that endpoint.

if I make the same request in the browser my laravel backend returns:

{
    "title": "Sausages",
    "description": "expiration date: 2020.10.01, 10euro",
    "url": "https://dynamicallyLoadedSPA.com/sausages",
    "type": "image",
    "tags": "food",
    "image": "https://img.laravelBackend.com/goods/4289/Untitled-2-04.jpg",
    "code": "<img src='https://img.laravelBackend.com/goods/4289/Untitled-2-04.jpg'>"
}

But after woordpress receives this there are no further requests for the actual picture at the

https://img.laravelBackend.com/goods/4289/Untitled-2-04.jpg

endpoint.

Why isn’t woordpress making a request for the picture and displaying it in the post and post editor UI?

I’m expecting a picture with a description to appear when I paste a link in the woordpress “gutenberg” editor.

ps. when I look at the html of the visually editable block in the gutenberg editor, this is the generated html (everything seems to be in order there)

<figure class="wp-block-embed"><div class="wp-block-embed__wrapper">
https://dynamicallyLoadedSPA.com/sausages
</div></figure>

it's just blank in the editor, no description, no image

0
Latvia Riga 4 months 0 Answers 20 views 0

Leave an answer