oEmbed function for Wordpress

Skip to first unread message

eric lepagnot

Nov 17, 2011, 5:42:52 PM11/17/11
to oem...@googlegroups.com
Sometimes i use the 1&1 hosting plans to install websites.
With shared hosting plan, 1&1 don't allow external urls by default.
Some tutorials speak about putting the parameter allow_url_fopen in
a php.ini file to solve the problem but that was not solving my problem.
So, i wrote this little snippet to force oEmbed to be displayed.

Add this lines to your functions.php file:

// Enable oEmbed on a specific element

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

I choose to apply it on the_content, and it works for me.
Maybe, it could help you if you encounter the problem too.

Eric Lepagnot.
Reply all
Reply to author
0 new messages