2

oEmbed does not seem to work on my theme. I simply see the bare URL. I haven't been able to find instructions on how to implement it.

Thanks.

  • 1
    you shouldn't have to do anything to implement it, WordPress does it automatically via a filter on the_content. does your theme output content via the_content? is there any code in your theme removing filters on the_content? – Milo May 3 '14 at 1:18
2

You didn't give the URL. Please check if oEmbed url listed on the internal WordPress whitelist

| improve this answer | |
0

Had the same problem, got solved here

I just add the code from the last comment in my child themes functions.php, now embeds are working fine. Seems to be necessary because of automatically added paragraphs

The code for functions from the reference mentioned above:

    add_filter( 'the_content', 'my_autoembed_adjustments', 7 );
/**
 * Add a new line around paragraph links
 * @param string $content
 * @return string $content
 */
function my_autoembed_adjustments( $content ){
    $pattern = '|(?<!")(?<!"\s)(https?:\/\/[^\s"\[<]+)|im';    // your own pattern
    $to      = "<p>\n$1\n</p>";                          // your own pattern
    $content = preg_replace( $pattern, $to, $content );
    return $content;
}
| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.