Home / functions.php / Enable oEmbed in Text/HTML Widgets
  • How to Enable oEmbed in Text/HTML Widgets

    enable-oembed-in-texthtml-widgets

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

    wordpress snippet : PHP

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

    ( WordPress codex functions, hooks, in this snippet. )

    widget_text, add_filter, _e, wp,