Limited Support
Dear Clients and Partners, we wish you a Merry Christmas and a Happy New Year! May this season bring you joy, peace, and good times with your loved ones.
Our support will be limited during the holidays, and we will return to full service on January 7.
Thank you for your understanding.
We appreciate your support this year and look forward to working with you in the new year.
Happy Holidays!
Hi, i am trying to embed a youtube video via code, it show me the video preview in editor but when i post it it shows nothing.
Hi @mrfahadkhan,
Just put this code in active WordPress theme's functions.php:
add_filter('wpforo_content_after', 'wpforo_custom_video_embed', 10);
function wpforo_custom_video_embed( $content ){
$paterns = array();
$paterns[] = "/<a[^><]+>\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i";
$paterns[] = "/<a[^><]+>\s*[a-zA-Z\/\/:\.]*youtu.be\/([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i";
$content = preg_replace($paterns, "<iframe width=\"420\" height=\"280\" src=\"//www.youtube.com/embed/$1\" frameborder=\"0\" allowfullscreen></iframe>", $content);
return $content;
}
For more advanced embedding options please check out wpForo Embeds add-on:
<iframe width="560" height="315" src="https://www.youtube.com/embed/WddvCQ6Bk0o" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Hi @mrfahadkhan,
You just need to insert the URL without iframe tag, only the < https://www.youtube.com/embed/WddvCQ6Bk0o > part.
By default, wpForo doesn't allow to use iframe tag, as it is not secure. There can be a lot of spam post.
In Dashboard > Forums > Tools > "Allow extra HTML tags" textarea you should add iframe tag name with its attributes . This will allow using iframe tag (use the source ( {:} ) button before passing the link).