How to Enable oEmbed in WordPress Text Widgets

Not too long ago, one in all our customers requested us learn how to allow oEmbed in WordPress text widgets. oEmbed is a protocol that permits your weblog to ask an oEmbed enabled web site to supply HTML wanted to embed dynamic content material. In easy phrases, it lets you simply paste a YouTube video URL in a weblog publish and let WordPress embed it routinely. You possibly can modify the oembed most width manually, or dynamically change oEmbed content material width and peak. Nonetheless, you can’t embed content material in a textual content widget utilizing oEmbed. On this article, we’ll present you learn how to allow oEmbed in WordPress text widgets.

All what you need to do is add the next code in your theme’s capabilities.php file or a website particular plugin:

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

Upon getting finished that, then you might be finished. You may have efficiently enabled oEmbed for text widgets. You possibly can head over to Look » Widgets to check it. Merely add a Youtube video URL in your text widget, and watch the magic.

For these of you who need to know what this code does, it merely provides a filter widget_text permitting text widgets to run shortcode for oEmbed and auto-embed content material.

For individuals who don’t wish to cope with code, then you’ll be able to merely activate Text Widget oEmbed plugin. It actually does the identical factor. The plugin solely has 2 strains of code that we shared above.

You May Also Like : How to Disable Image Attachment Pages in WordPress

We hope that this text helped you allow oEmbed in text widgets. You probably have any questions or feedback, then please tell us by leaving a remark under.

1 thought on “How to Enable oEmbed in WordPress Text Widgets”

  1. Pingback: How to Split Large XML Files in WordPress ( Step By Step )

Leave a Comment

Your email address will not be published. Required fields are marked *