• Resolved naner13

    (@naner13)


    When I’m adding a post, select the VIDEO format, provide an URL, and go to the PREVIEW page all I get is the URL and not a video player.

    Same behavior when using a shortcode, all I get is the URL and not a video player.

    I have tried disabling and enabling plugins, no luck.

    If the problem is related to the wp_oembed_get function, what is the easiest way to test it? What is the minimum files I need in order to be able to call this function?

    What else should I be considering?

    Thanks in advance.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Moderator James Huff

    (@macmanx)

    What is the video you’re trying to embed?

    Thread Starter naner13

    (@naner13)

    Hey James,

    I’ve come a lot further since I posted this question, but I’m still having issues. First I set up a test where I called wp_oembed_get and noticed that it would ALWAYS return false regardless of the video I was trying to load (vimeo, youtube). We can’t figure out why that’s happening.

    We modified the script to be able to get more information/detailed errors from the server, here’s the response: https://gist.github.com/anonymous/efc99814d2d4e7a4a7ad

    Notice that under the error sections it says: “Resolving timed out after 5123 milliseconds”. To prove that DNS was working fine I set up a php script to call gethostbyname for vimeo.com and also made a call to the video url using curl, both worked fine, meaning PHP was able to resolve the host. We tried to change the timeout on Apache and PHP but that didn’t solve the problem.

    We are running a CentOS 7 Linux installation. SELinux is set to permissive and we have even tried to set the firewall off but still doesn’t work. We also set up a fresh wordpress install on the same server to test things, so it is not plugin or theme related.

    On the fresh install we set all permissions to 777 to make sure it was not a permissions issue either. No luck.

    Any ideas? Thanks a lot!!!

    Moderator James Huff

    (@macmanx)

    Ok, you can set those permissions back to 755, that won’t have any effect on oEmbed.

    Try embedding this video via oEmbed by just pasting the URL:

    https://www.youtube.com/watch?v=DVwHCGAr_OE

    If that fails, then try their normal embed code:

    <iframe width="560" height="315" src="https://www.youtube.com/embed/DVwHCGAr_OE" frameborder="0" allowfullscreen></iframe>

    Let us know how each goes, and also the URL of your site if you can share that.

    Thread Starter naner13

    (@naner13)

    What do you mean by via oEmbed? Something like the following?

    require_once("wp-load.php");
    $embed_code = wp_oembed_get('http://vimeo.com/114998128');
    print($embed_code);

    It returns false everytime. Yes, using the embed code works fine.

    Let me make sure all those permissions are fixed and I’ll send the URL.

    Thanks again.

    Moderator James Huff

    (@macmanx)

    No, I mean literally just copy/paste the following URL (unlinked, no HTML around it) in the post content:

    https://www.youtube.com/watch?v=DVwHCGAr_OE

    This is how oEmbed works in WordPress.

    https://codex.wordpress.org/Embeds

    Thread Starter naner13

    (@naner13)

    Nothing happens, it displays the URL as plain text.

    Thread Starter naner13

    (@naner13)

    Here’s the URL to the fresh wordpress install.
    http://test.outlookmag.org/

    Moderator James Huff

    (@macmanx)

    Hm, that is definitely odd, you did add it correctly.

    Ok, looking through similar threads, I found one from two months ago (which I was in too, ironically). In that, Otto mentions the following:

    I see that the “not-embeddable” message is returned by WordPress when it cannot get the oEmbed data for whatever reason. There are many possible causes for this:

    – Your webserver can’t talk over SSL for whatever reason. Try using a plain http: link, not an https: one.

    – Your webserver has no DNS connectivity. If this is the case, your dashboard will be really slow and not show things like the WordPress News panel and so on.

    – Your webserver is behind a firewall and cannot talk to the outside world. Ask your hosting service about that. In order to embed things from YouTube or Vimeo, the server has to actually get the embed code from YouTube or Vimeo, basically, so has to be allowed to do so.

    https://wordpress.org/support/topic/youtube-oembed-problems?replies=11#post-6247402

    Thread Starter naner13

    (@naner13)

    Thanks again James,

    1. I have tried https and http URLs (Vimeo and YouTube). Does not seem to make a difference.

    2. INTERESTING… the dashboard is indeed EXTREMELY slow, BUT, the news panel works just fine. We have tested the DNS in multiple ways:

    – Ping from the server
    – gethostbyname on PHP
    – curl call to vimeo.com

    They all worked fine, they resolved the hostname.

    3. We have tried disabling the firewall, it didn’t fix it.

    Could it be an Apache/PHP configuration or module that we are missing?

    Thanks!

    Moderator James Huff

    (@macmanx)

    It is entirely possible. WordPress works just find on standard LAMP and LEMP stacks, but it’s always possible to customize our (or in) something that causes things to go up in flames.

    Are you able to cURL to Vimeo properly?

    Thread Starter naner13

    (@naner13)

    Yes, I was able to cURL to Vimeo just fine.

    Moderator James Huff

    (@macmanx)

    Hrm, ok them. I don’t suppose you’d be interested in recompiling Apache and PHP? πŸ™‚

    Thread Starter naner13

    (@naner13)

    We are using stock packages from CentOS. Other than memory tuning and setting virtual folders we haven’t done much! :/

    Thread Starter naner13

    (@naner13)

    We are going to try to monitor the network and see if we can see anything there (when looking around in the dashboard or trying to using oembed).

    Moderator James Huff

    (@macmanx)

    Excellent, please let us know what you find!

Viewing 15 replies - 1 through 15 (of 17 total)

The topic ‘Testing wp_oembed_get function?’ is closed to new replies.