Enable oEmbed in Text/HTML Widgets

Adding this PHP snippet to the functions.php of your wordpress theme will enable oembed for widgets.

add_filter( 'widget_text', array( $wp_embed, 'run_shortcode' ), 8 );
add_filter( 'widget_text', array( $wp_embed, 'autoembed'), 8 );

Comments  Leave a Reply

  1. Embed Tweets, YouTube Videos, and More into Text Widgets with a URL - WPMU DEV April 5, 2014 at 8:00 am

    […] to wpsnipp for […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!