admin管理员组文章数量:1321065
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( '/*', '/', 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=;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": ";,
"type": "image",
"tags": "food",
"image": ".jpg",
"code": "<img src='.jpg'>"
}
But after woordpress receives this there are no further requests for the actual picture at the
.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">
</div></figure>
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/*', 'https://laravelBackend/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/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/sausages",
"type": "image",
"tags": "food",
"image": "https://img.laravelBackend/goods/4289/Untitled-2-04.jpg",
"code": "<img src='https://img.laravelBackend/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/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/sausages
</div></figure>
Share
Improve this question
edited Sep 29, 2020 at 20:02
Nils Riga
asked Sep 29, 2020 at 19:50
Nils RigaNils Riga
335 bronze badges
1
- I turned on logging for WP and no errors there. – Nils Riga Commented Sep 29, 2020 at 19:56
1 Answer
Reset to default 0I think your oEmbed implementation is wrong. You can see in the WP-oEmbed class that WordPress supports four type values: photo, video, link and rich; whereas you're returning type=image.
From the spec section 2.3.4 it looks like that's WordPress's list is complete and 'image' isn't generally supported. You possibly meant type=photo, but those aren't generally linked and have mandatory height and width properties that you're not supplying.
So I think your options are:
- change your oEmbed provider to return a type=rich instead, and generate the HTML to include there
- extend WordPress to support type=image: implement the oembed_dataparse filter (called from the bottom of the function I linked above), detect type=image there and return the generate HTML you'd want to include from the oEmbed data returned.
However chances are you'll also have to extend Gutenberg to work with the new type too, and I'm not sure how to do that.
本文标签: How to oEmbed MySite in Wordpress
版权声明:本文标题:How to oEmbed MySite in Wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742092273a2420339.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论