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


Staff member
I am using a <a href="" 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:

&lt;iframe width="670" height="380" src="" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

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


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.

$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!