I've inherited a theme that uses a totally in-house post display, and doesn't use the post loop. My question is, what function do I have to feed my post content object through in order to use oEmbed to replace the YouTube and Vimeo links in the post body with the oEmbed code?


You might be looking for WP_Embed::autoembed(). Try:

add_filter( 'the_content', array( 'WP_Embed', 'autoembed' ) );

in your theme's functions.php file.

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.