Auto-Embed Media in WordPress Text Widgets

I’ve used a trick for quite awhile that allows me to place shortcodes in the text widgets on my site.

WordPress 2.9 was released with the ability to auto-embed media, such as youtube videos, in posts by simply pasting a plain text URL into the post content.  I have thought for some time that it would be really great to be able to borrow from the idea behind the shortcode in text widget trick to enable the same auto-embed functionality in my text widgets.

With the help of a couple of my fellow StudioPress forum moderators, Charles Clarkson and Gary Jones, I now have a solution!  The YouTube video in the footer of this site, for example, is placed using the


shortcode to automatically embed the video.

This trick can be acomplished by adding the following code to the functions.php file in your sites active theme directory.


This should allow both plain text urls in text widgets and the





Would look like this:


Would look like this: