Hide Suggested YouTube Videos in Divi Module

by | Dec 15, 2020 | Divi, Wordpress Plugins | 0 comments

We are dividing this article into three sections.

How and why it Occurs

There is no doubt that Divi is one of the best WordPress themes available on the market today. Most of the users are using this themes and also recommend to others as well.

Even We TrustyPlugins are using the Divi theme and our hundred of Clients are using this awesome theme. Divi comes with unique and awesome page builder features. It has many in built modules to build the layout structure for your website.

Many of the Divi users use the Divi Video Module to embed YouTube videos on the page and want to hide suggested YouTube videos in Divi’s Video Module.

This Embed Video Is ending with some suggested Videos

But In this video module if you embed directly YouTube video then our Clients/Users was facing a issue regarding suggested videos that will popping up when YouTube video end because its default behavior of YouTube to show these suggested videos at the end of video. So generally not everyone wants to show that out of the focus content. Site admin would not distract the valuable user with that YouTube videos. Even their suggested videos comes from other YouTube Channels means these suggested videos are not required for many of the users. So we decided to comes up with the solution for that type of users.

How Solution Works

First of all there is no solution to hide suggested videos by Divi till the current Update.

We read many articles/threads related to this topic but no-one comes with the right solution.

So Official YouTube provides the solution if we use any custom script or YouTube API to integrate that embed video. You can see the official YouTube API player’s Parameter to understand the hack.

How To Fix for Divi

So At the end , We all need a fix for the divi’s Video Module. So to do this we need to make that happen with custom javascript/jQuery code. As you read the documentation on Official YouTube API Parameters. We need to add ?rel=0 parameter at end of the embed url.

Do IT Step by Step

Step 1: First Of all you need to give a unique ID to Divi’s Video Module. To do this you need to go to your Video Module settings>Advanced tab>CSS Classes & IDs toggle and paste“trusty_hide_suggested” into the css ID field.

Step 2: Go to Divi>Theme Options>Integrations and add following code to the < head > of your site.

Hide suggested youtube videos in divi's Video Module
var src=$('#trusty_hide_suggested iframe').attr("src");
var new_src=src+"&rel=0"
$('#trusty_hide_suggested iframe').attr("src",new_src);

Embed Video After Implementing the Code

Hope It will work for you. Submit Your feedback with valuable Comments.