Stopping Related videos at the end of embedded Youtube video playing
Since Google has taken over Youtube they have changed the way you can play embedded videos from Youtube.
I know I would like to prevent other videos being displayed at the end of the video to prevent people clicking on them to jump of the site.
But Google has taken away the direct command to do this.
So is there any way to prevent them being shown.
I discovered that there is a rel=0 command you can add to the embed code to display related videos from the same channel, but this still shows videos.
While browsing for something else in the plugin directory I scanned down to come across another plugin for Youtube called 'Youtube embed' plugin by embedplus team.
Looking at the description it stated that you can turn off the related videos, so it was worth a try on a test site.
The plugin states that it is compatible with the Gutenberg (block) editor as well as the classic.
For this trial I am trying a classic editor.
InstallationSo install the plugin in the standard method.
And activate it.
You get a wizard popup - I cancelled that, but you can go through it if you want to.
After installation you get a new menu item in your wordpress dashboard- youtube free.
Clicking on this gets you to the settings menu.
The one which is most interesting is the hide related videos.
The other one is to hide the quick setup guide.
Go through the others and set or not as you wish to show the videos.
Click save before changing tabs.
In operationTo use this plugin you go to the article you want the video embedded in and click on the new 'youtube' button at the top.
A visual wizard pops up and allows you to select a single video, a playlist , live streaming or a channel.
I didn't investigate the other options - I suspect you might need a google api key ( easily obtained follow the help video) and clicked on the embed a single video.
You can either search for a video ( requires an api key) or just enter a video url ( note this is the one which is displayed when you click on the share arrow under the video.
Pasting this into the box allows you to embed automatically or copy the shortcode if your cursor is not in the right position.
Note - the shortcode is entered into the visual editor not the text editor.
Pasting the code into your article will only show the shortcode until you preview it.
Then you will see the video.
In UseI played it, and skipped to near the end, and on finishing no related videos were shown.
So at the moment ( april 2019) this plugin will prevent related videos from being displayed.
For me the only problem is that you never see the code used to prevent the related videos being displayed at the end.
But being an engineer - i just viewed the source code for the page and got the code.
There is a data-relstop="1" command in there that maybe stopping them but it is part of a code to prevent it.
I hope this helps those members who have been asking for a solution to this problem.
If it does , don't forget to click on the like button and leave a comment below.
I'm going to go try right now! Thank you so much for sharing!
Brooke