Automatically add parameter to embedded youtube video - Regular Expressions help? (PHP, Wordpress)

admin

Administrator
Staff member
I am using a <a href="http://wordpress.org/extend/plugins/youtube-favorite-video-posts/" rel="nofollow">plugin</a> that imports the favourites from a youtube channel as posts in wordpress.

It works great and creates posts with the content:

Code:
&lt;iframe width="670" height="380" src="http://www.youtube.com/embed/videoid" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

However, there are no options to add embed parameters such as:

Code:
&amp;showinfo=0

to the embed parameter.

Thus I am considering loading the content into a variable and running a regular expression on it to add the parameter &amp;showinfo=0 after videoid.

Code:
$video = get_the_content();    
echo preg_replace('embed/(?:(?!").)*', "$1&amp;showinfo=0", $video);

I have always struggled with regular expressions, I'm sure the above is not really the right expression. Any help or even another suggestion would be greatly appreciated!