• Register
Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How about an automatic video embed plugin (YouTube only)?

+2 votes
So, now that I figured out why my YouTube code was being scrubbed, I thought I would create a function to automatically convert YouTube links into YouTube embed code.  This uses the new YouTube iframe code, not the old embed code.  The plugin is here:


It works with the markdown editor generated code, but I haven't tested it with the wysiwyg generated code.  Should be fine.  It checks for the url in both questions and answers, with or without <a> tags surrounding them, and replaces them with the iframe content.  It doesn't change the database entry, and can be switched off via the control panel. It can be extended to include other video sites, if someone can give me the two variables, i.e. the hyperlink and the code to replace it with.
asked Aug 4, 2011 in Plugins by NoahY2
recategorized Nov 13, 2011 by gidgreen

1 Answer

0 votes


Thanks, but strange it works only together with badges plugin, without badges plugin i have error at admin section:
Fatal error: Call to undefined function qa_get_badge_list() in /xxx/xxx/xxx/xxx/xxx/qa-plugin/embed/qa-embed-admin.php on line 16


answered Aug 4, 2011 by Another one
oh dear... forgot to remove that :) gone now.
Works thanks but now i getting error at login, register and feedback pages:

Warning: Invalid argument supplied for foreach() in /xxx/xxx/xxx/xxx/xxx/qa-include/qa-page.php on line 396

Warning: Invalid argument supplied for foreach() in /xxx/xxx/xxx/xxx/xxx/qa-include/qa-page.php on line 481

Warning: Invalid argument supplied for foreach() in /xxx/xxx/xxx/xxx/xxx/qa-include/qa-page.php on line 498
I don't know where those errors are coming from.  It's something about caching that I don't understand.  I must be doing something it doesn't like.  Anyway, you can safely ignore those errors, and error display should be off on production sites anyway (that's what the error log is for).