0

I'm trying to oembed some facebook video . . . without ay chance so far . .. I'd like to avoid any plugin for this.

I went through toe documentation but nothing to do, I'm declaring in my functions.php like below ( I also tried to follow the steps of this article with no luck):

function oembed_facebook() {

wp_oembed_add_provider( 'https://www.facebook.com/video.php', 'https://www.facebook.com/plugins/video/oembed.json', false );
wp_oembed_add_provider( 'https://www.facebook.com/*/videos/*', 'https://www.facebook.com/plugins/video/oembed.json', false );

}
 add_action( 'init', 'oembed_facebook' );

Then in put in my page the following:

https://www.facebook.com/plugins/video/oembed.json/?url=https://www.facebook.com/facebook/videos/10153231379946729/

But i just have the code url being display . .no content being embeded . . .

Id anyone could let me know what I am doing wrong ?

It will be super ! Thanks a lot for your time and help !

  • 1
    Since 4.7 Facebook embed are supported out of the box in WordPress, so you shouldn't need to do anything. I just tested your example URL in a relatively fresh install without a problem. – Jacob Peattie Mar 3 '18 at 11:14
  • Hmmm when I put that link in a page template it just display the url in my side - it’s not pulling the content .... does it needs to be add in a special tag or something ? – thibaultlgd Mar 3 '18 at 11:16
  • 1
    In a template? It's not going to turn into an embed automatically if it's just hardcoded into a template. Nothing will. If you're embedding the video programatically, pass the URL to wp_oembed_get(). – Jacob Peattie Mar 3 '18 at 11:18
  • Hi Jacob, Thanks for this, do you have any example by any chance ? It will be super .. .thank you – thibaultlgd Mar 4 '18 at 20:44
  • Yes it does work, The thing is i want to only embed the image for example, not all the content ( headers , likes, and text). How is that possible ? – thibaultlgd Mar 6 '18 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.