{"id":1244,"date":"2019-02-20T05:17:39","date_gmt":"2019-02-20T05:17:39","guid":{"rendered":"https:\/\/www.ineedwebsite.com.au\/?p=1244"},"modified":"2020-12-08T02:52:41","modified_gmt":"2020-12-07T16:52:41","slug":"disable-hide-youtube-related-videos-turn-off-seo-sunshine-coast","status":"publish","type":"post","link":"https:\/\/www.ineedwebsite.com.au\/disable-hide-youtube-related-videos-turn-off-seo-sunshine-coast\/","title":{"rendered":"How to Get Rid of Related Videos in Embedded YouTube Player"},"content":{"rendered":"<h2>Hide Youtube Related Videos<\/h2>\n<p>Sometimes unchecking the box that says \u201callow advertisements to be displayed alongside my videos\u201d is not enough for actually getting rid of ads accompanying a YouTube video. This becomes a real problem when the ads are showing up on your own website. The fact that Youtube continuously updates its website navigation and settings makes it challenging to find relevant information online to solve this issue. We prepared a couple of solutions that will work for you at all times and most likely never expire.<br \/>\nIf you\u2019ve spent some time searching already you probably are familiar with the trick \u201crel=0\u201d, \u201c&amp;rel=0\u201d or \u201c?rel=0\u201d. Unfortunately, none of those will help you to get rid of ads unless you\u2019re signed in on Youtube. This change happened quite recently (September 2018) so not many people heard about the change yet and are spending time on researching why this doesn&#8217;t work after inserting it into their code or URL. Here&#8217;s <em>how to hide youtube related videos!<\/em><\/p>\n<p>&nbsp;<\/p>\n<h3>How to Disable Youtube Related Videos with a Code or Plugin<\/h3>\n<p>You can work around this using the YouTube Player API to show custom HTML instead of related videos. Here is a simple code that displays a \u201creplay\u201d button over the video once it completes, hiding the related videos:<\/p>\n<p>&lt;style&gt;<br \/>\n#playerWrap {<br \/>\ndisplay: inline-block; position: relative;<br \/>\n#playerWrap. shown::after {<br \/>\ncontent:&#8221;&#8221;; position: absolute; top: 0; left: 0; bottom: 0; right: 0; cursor: pointer; background-color: black; background-repeat: no-repeat; background-position: center; background-size: 64px 64px;<br \/>\nbackground-image: url(data:image\/svg+xml;utf8;base64, PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9;<br \/>\n&lt;\/style&gt; &lt;div&gt; &lt;div id=&#8221;playerWrap&#8221;&gt; &lt;iframe<br \/>\nwidth=&#8221;640&#8243; height=&#8221;360&#8243; src=&#8221;https:\/\/www.youtube.com\/embed\/OsDg2h3M1RE?enablej sapi=1&#8243;<br \/>\nframeborder=&#8221;0&#8243; &gt;&lt;\/iframe&gt; &lt;\/div&gt; &lt;\/div&gt; &lt;script&gt;<br \/>\nvar playerFrame = document.currentScript.previous Element Sibling.children [0].children [0];<br \/>\nvar tag = document.createElement(&#8216;script&#8217;); tag.src = &#8220;https:\/\/www.youtube.com\/iframe_api&#8221;; var firstScriptTag = document.getElementsByTagName(&#8216;script&#8217;)[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);<br \/>\nvar player; function on YouTubeIframeAPIReady () { player = new YT.Player(playerFrame, {<br \/>\nvideoId: &#8216;M71c1UV-VE&#8217;, events: {<br \/>\n&#8216;onStateChange&#8217;: onPlayerStateChange<br \/>\n});<br \/>\nfunction onPlayerStateChange (event) { if (event.data == YT.PlayerState. ENDED) {<br \/>\ndocument.getElementById(&#8220;playerWrap&#8221;).classList.add(&#8220;shown&#8221;);<br \/>\ndocument.getElementById(&#8220;playerWrap&#8221;).addEventListener(&#8220;click&#8221;, function() {<br \/>\nplayer.seekTo(0);<br \/>\ndocument.getElementById(&#8220;playerWrap&#8221;).classList.remove(&#8220;shown&#8221;); })<br \/>\n; &lt;\/script&gt;<\/p>\n<p>Also, it is possible to make the video stop before it ends so the ads don\u2019t show up.<br \/>\nHowever, there is an easier way &#8211; plugins. Unfortunately, their usefulness can expire and you can\u2019t always rely on them but who cares if it works? Here is a link to one that is simple and easy to install:<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"A4gdg6QoYx\"><p><a href=\"https:\/\/wordpress.org\/plugins\/hide-related-video-youtube\/\" target=\"_blank\" rel=\"noopener\">Hide Related Video Youtube<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Hide Related Video Youtube&#8221; &#8212; Plugin Directory\" src=\"https:\/\/wordpress.org\/plugins\/hide-related-video-youtube\/embed\/#?secret=AceVaESaN9#?secret=A4gdg6QoYx\" data-secret=\"A4gdg6QoYx\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><br \/>\nIt&#8217;s important to pay attention to the date of the article\/video you use to find a solution because YouTube often changes its website settings.<\/p>\n<h4>Turn Off Youtube Related Videos Guide<\/h4>\n<h5><a href=\"http:\/\/www.ineedwebsite.com.au\/\">Web Design &amp; SEO Sunshine Coast<\/a><\/h5>\n","protected":false},"excerpt":{"rendered":"<p>Hide Youtube Related Videos Sometimes unchecking the box that says \u201callow advertisements to be displayed alongside my videos\u201d is not enough for actually getting rid of ads accompanying a YouTube video. This becomes a real problem when the ads are showing up on your own website. The fact that Youtube continuously updates its website navigation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1267,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[31],"tags":[],"class_list":["post-1244","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-custom-projects"],"_links":{"self":[{"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/posts\/1244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/comments?post=1244"}],"version-history":[{"count":0,"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/posts\/1244\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/media\/1267"}],"wp:attachment":[{"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/media?parent=1244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/categories?post=1244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ineedwebsite.com.au\/wp-json\/wp\/v2\/tags?post=1244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}