WordPress maintenance or security needs? Reach out!
TLDWP

Plugin: related-youtube-videos (Used by 37 domains)

Related YouTube Videos

Related YouTube Videos is a free WordPress plugin that embeds a number of, well, YouTube videos that are related to your content. The list is put together by using the YouTube search API. And you can specify the relation between the videos and your content by:

  • the title of your current post, page or custom post type.
  • the tags of your current post, page or custom post type.
  • the categories of your current post, page or custom post type.
  • any keywords you specify.

Also, this plugin offers you two ways to embed related videos:

  1. by using the shortcode [relatedYouTubeVideos] somewhere in your post/page content.
  2. by using the WordPress widget “Related YouTube Videos” in any of your widget areas (multiple instances are possible).

Disclaimer / Important

As of April 2015 the YouTube API can only be accessed when you have a valid key for the data API. Also, the number of free requests per day is limited!

There is a nice and short video tutorial (https://www.youtube.com/watch?v=zOYW7FO9rzA) on how to get such an API key. But it’s up to you to make sure your stay within the free limit or keep track of the costs when you need more than that!

Please read Youtube and Google’s terms and conditions for more details.

The Shortcode

I’m only going to explain the options/paramters for the shortcode but they work exactly the same for the widget, of course.

You can put the shortcode [relatedYouTubeVideos] anywhere you want inside the content of a page, post, or custom post type – as long as your WordPress theme is supporting shortcodes.

You can use the following options/parameters/attributes:

Appearance

  • id – You can specify the HTML id attribute for the wrapping
      element.
    • class – You can specify an additional HTML class name for the wrapping
        element
      • width – Width of the HTML video object
      • height – Height of the HTML video object
      • preview – “true” will only display the preview image and only load the video (via Javascript!) when this image has been clicked.
      • showVideoTitle – “true” if you want to show the video title right below the video itself. Can be styled via CSS class .title
      • showVideoDescription – “true” if you want to show the video description below the video, respectively, when the video title is displayed right below the title. Can be styled via CSS class .description
      • autoplay – “true” if you want the video to automatically start playing when ready. This will obviously not work in preview mode!!
      • exclude – Comma separated list of post/page IDs where no videos shall be displayed.

      Configuration

      • max – Number of videos (or search results) that will be returned. Can be any number between 1 and 10!
      • random – Select MAX number of videos out of RANDOM number of videos.
      • offset – START and OFFSET are interchangably the same and just other words for the same option.

      YouTube

      • relation – Specify the kind of relation that shall be used for searching YouTube. Can either be ‘postTitle’, ‘postTags’, ‘postCategories’, or ‘keywords’ (in which case the attribute ‘terms’ will be used for the YouTube search).
      • terms – Search YouTube for these terms – no separating commas required.
      • exact – Set to ‘true’ will (try to) search for the exact phrase.
      • orderBy – Can either be ‘published’, ‘rating’, ‘viewCount’, (default) ‘relevance’.
      • lang – {2-letter-language-code} will show videos in that language.
      • region – {2-letter-country-code} will show videos that are actually viewable in that region/country.
      • author – Only show videos from a given YouTube User(name) .
      • filter – Add additional keywords or filtering search parameters. Those will always be added even when the relation is set to post title, tags, or so. You can also manually add post tags by adding ‘+postTags’, categories by adding ‘+postCategories’, the post title by adding ‘+postTitle’, post meta data by adding ‘+postMeta:key’ to the filter.
      • viewRelated – set to “no” or “false” will not show more related videos at the end of a clip.

      I recommend always using the attributes ‘relation’, ‘max’, and if the relation shall be ‘keywords’ the ‘terms’ attribute. Depending on your design you might also set a custom width and height for the videos so they fit in properly.

      Shortcode Example 1: [relatedYouTubeVideos relation=”postTags” max=”3″] Will show three videos coming back from the search YouTube for (all!) the tags you have assigned to this post or page.

      Shortcode Example 2: [relatedYouTubeVideos relation=”keywords” terms=”monty python” max=”5″] Will show five Monty Python videos from YouTube.

      Shortcode Example 3: [relatedYouTubeVideos relation=”keywords” terms=”real madrid” exact=”true” max=”2″] Will search for the exact phrase “Real Madrid” and (hopefully) not just anything “real”.

      Shortcode Example 4: [relatedYouTubeVideos relation=”postTitle” max=”1″ orderBy=”viewCount” start=”1″] Will show the second most popular video (the first being skipped) relating to your post or page title.

      Shortcode Example 5: [relatedYouTubeVideos relation=”keywords” terms=”monthy python” max=”1″ showVideoTitle=”true” showVideoDescription=”true”] Will show a Monty Python video, followed by the video title, followed by the video, followed by the video description.

      Shortcode Example 6: [relatedYouTubeVideos relation=”keywords” terms=”monthy python” max=”1″ preview=”true”] Will show the thumbnail of a Monty Python video and load + play the video only when it’s being clicked.

      Shortcode Example 7: [relatedYouTubeVideos relation=”postTitle” filter=”intitle:official -intitle:cover” max=”1″ preview=”true”] If the post title is about a music video (band and song title, for example) this will only show the official music video.

      Shortcode Example 8: [relatedYouTubeVideos relation=”postTitle” filter=”+postCategories” max=”1″ preview=”true”] Will use the post title and a list of all categories the post is in to search YT.

      The Widget

      The widget almost works the same way. Or at least it has the same options for configuring the video request. If you log into your WordPress backend and go to the “Appearance > Widget” menu (given that your theme supports widgets) you can drag&drop a widget instance into the widget area of your choice.

      The relatedYouTubeVideos widget allows multiple instances. So you can put as many widgets as you like into as many widget areas as you like.

      The difference between the widget and the shortcode is not in terms of functionality but usually in the context they reside. Widgets usually go into sidebars or footers and alike and the same widget usually shows up for many, if not all pages, just the same. Shortcodes are placed inside the actual content and therefore will only show up when the page or post where they’re put is shown.

      There is one functionality that only applies to widgets: In the options field “Hide on” you can set a list of comma separated, numerical post IDs on which the widget will not show up. This way you can easily exlude the widget on certain post. You can also use PAGE ids for that matter, since under the hood WordPress manages all “post type” IDs the same.

      Randomize Results

      The same keywords (or post title/tags) will ususally return the same video(s) for a period of time. Basically, that’s up to YouTube but in can take days, weeks or even months until fresh videos will show up.

      When you set a numeric value for the RANDOM parameter/option you can get random videos from a pool of results. The MAX value plays along with the RANDOM value and both read like this: Show me {MAX} random videos out of {RANDOM} videos.

      [relatedYouTubeVideos relation=”keywords” terms=”fast cars” max=”2″ random=”10″] will actually request 10 videos from YouTube but only show 2 random ones out of that 10.

      So RANDOM will determine the size of the pool MAX videos will be chosen from.

      System Requirements

      In order to run this plugin you need the following components installed and enabled in your server and PHP environment:

      • PHP 5.1.2+
      • SimpleXML (usually is enabled by default anyways)
      • cURL (preferred) or fopen/fsockopen
      • OpenSSL + HTTPS wrapper (is only required if cURL is not available)
      • WordPress 3.0+

      In general you should not have to worry about these things since they’re included in most web hosting packages nowadays.
      But to be sure you can download and install this plugin and then check the backend page. There is a “System Requirements” section that will show you exactly if you can good to go or if there is any problem.

      In case you’re getting a “URL file-access is disabled in the server configuration” error you should make sure your PHP.ini file contains these two lines:

      allow_url_include = on

      allow_url_fopen = on

      Available Languages:

      • English
      • German
      • Serbo-Croatian – by Borisa Djuraskovic (Webhostinghub)
        Developers can also use the API class outside the plugin context, for example in a theme template file. All you have to do is include the class (if it doesn’t already exist) and create an object like this:

        /* Load the “Related YouTube Videos” API class if it does not exist yet. */
        if( !class_exists( ‘RelatedYouTubeVideos_API’ ) ) {

        $file = str_replace( ‘/’, DIRECTORY_SEPARATOR, ABSPATH ) . ‘lib’ . DIRECTORY_SEPARATOR . ‘RelatedYouTubeVidoes’ . DIRECTORY_SEPARATOR . ‘API.php’;

        if( file_exists( $file ) ) {

        include_once $file;
        

        }

        }
        /* Only continue if the API class could be loaded properly. */
        if( class_exists( ‘RelatedYouTubeVideos_API’ ) ) {

        $RytvAPI = new RelatedYouTubeVideos_API();

        /* Do your configuration */
        $data = $RytvAPI->validateConfiguration(
        array(
        ‘relation’ => ‘postTitle’,
        ‘max’ => ‘3’,
        ‘width’ => 150,
        ‘height’ => 150,
        ‘lang’ => ‘en’,
        ‘region’ => ‘de’,
        ‘class’ => ‘left center inline bg-black’,
        ‘preview’ => true
        )
        );

        /* Search YouTube. */
        $results = $RytvAPI->searchYouTube( $data );

        /* Generate the unordered HTML list of videos according to the YouTube results and your configuration. */
        $html = $RytvAPI->displayResults( $results, $data );

        echo $html; // Or do with it whatever you like 😉

        }

DomainExposuresHeadersLast Checked
b*z*n*o*a*a*o.net A Aug 5, 2026
p*e*l*m*n.com (WP 4.8.25) F Jul 31, 2026
i*m*a*o*t*f.com (WP 7.0.2) F Jul 30, 2026
s*k*r*m*c*i*p*c*.com F Jul 30, 2026
t*e*a*g*t*a*.com (WP 4.9.26) F Jul 29, 2026
a*r.lu (WP 7.0.1) F Jul 28, 2026
c*n*a*i*g*e*.com (WP 7.0.2) D Jul 27, 2026
g*e*n*n*o*s*u*p*y.com A Jul 27, 2026
i*t*r*e*-*a*k*t*n*c*n*u*t*n*.com F Jul 26, 2026
s*u*e*t*a*a*n.com (WP 6.9.5) F Jul 26, 2026
e*i.it (WP 6.9.5) F Jul 25, 2026
c*l*u*u*c*a*h*s.com F Jul 25, 2026
p*t*e*r*o*l*.com F Jul 24, 2026
w*l*a*a*e*.com F Jul 23, 2026
w*r*h*p*r*h*v*.com F Jul 20, 2026
t*u*t*y*e*h*n*c.com C Jul 17, 2026
n*t*i*g*.com F Jul 15, 2026
m*s*a*e*r*a*t*a*.com (WP 6.5.5) F Jul 14, 2026
s*a*s*o*s*e*k*r*.com D Jul 12, 2026
e*a*d*m*r.com (WP 6.9.4) F Jul 11, 2026
a*d*m*d*a.com (WP 7.0.1) F Jul 11, 2026
t*e*r*s*n*a*i*n*c*o*l.com F Jul 10, 2026
c*e*d*o*e.com (WP 6.9.4) F Jul 10, 2026
n*n*t*m*l*s*r*j*c*.com F Jul 10, 2026
t*p*e*g*.com F Jul 10, 2026
c*u*t*y*u*i*b*o*i*g*g*n*y.com D Jul 8, 2026
b*n*e*e*j*n.com (WP 4.7.29) F Jul 7, 2026
m*d*a*e*r*.fr (WP 5.6.17) F Jul 6, 2026
e*e*w*i*s*z.com F Jul 6, 2026
s*a*t*e*t*l*t*s*e*k*r*.com D Jul 5, 2026
a*r*r*s*p*o*u*t*r*v*e*s*o*e.com (WP 6.9.4) F Jul 5, 2026
m*i*a*i*n*a*a.com (WP 6.9.4) F Jul 5, 2026
e*h*t*l*b*o*.com D Jul 5, 2026
l*p*n*y*v*s*r*-*m*e*i*l*.com F Jul 4, 2026
p*k*o*a*v*.ru F Jul 1, 2026
u*o*y*p*o*e.com (WP 7.0) F Jul 1, 2026
w*z*o.de (WP 6.9.4) F Jun 20, 2026

Top 50 Plugins

Plugin Count
elementor 1,769,667
contact-form-7 1,750,273
elementor-pro 1,052,325
woocommerce 816,129
revslider 608,055
jetpack 454,225
js_composer 419,373
wp-rocket 341,815
essential-addons-for-elementor-lite 264,453
gravityforms 256,870
complianz-gdpr 256,729
google-site-kit 232,967
cookie-law-info 227,806
instagram-feed 224,470
sitepress-multilingual-cms 210,495
header-footer-elementor 206,489
google-analytics-for-wordpress 205,192
bluehost-wordpress-plugin 192,371
elementskit-lite 179,960
gutenberg 167,343
cookie-notice 148,595
litespeed-cache 144,715
gtranslate 124,691
wpforms-lite 123,527
the-events-calendar 122,123
astra-sites 113,022
popup-maker 109,488
woocommerce-payments 109,114
gutenberg-core 103,125
tablepress 102,364
honeypot 97,749
astra-addon 93,668
wp-smushit 90,688
duracelltomi-google-tag-manager 90,311
layerslider 89,063
all-in-one-seo-pack 88,922
bb-plugin 86,775
coblocks 86,696
akismet 84,883
premium-addons-for-elementor 84,279
cleantalk-spam-protect 82,400
ml-slider 82,295
mailchimp-for-wp 81,556
megamenu 80,162
woocommerce-gateway-stripe 79,291
jet-engine 77,969
fusion-builder 76,911
ewww-image-optimizer 76,797
wp-pagenavi 76,513
smart-slider-3 76,013

Top 50 Themes

Theme Count
hello-elementor 620,666
Divi 495,140
astra 413,550
flatsome 139,444
Avada 120,795
generatepress 114,669
oceanwp 80,251
kadence 78,565
pub 72,288
enfold 68,605
salient 65,030
twentyseventeen 54,263
bb-theme 53,343
betheme 52,434
twentytwentyfour 52,372
blocksy 50,764
cocoon-master 49,260
dt-the7 45,394
twentytwentyfive 45,020
woodmart 43,699
neve 38,029
Avada-Child-Theme 36,914
gox 36,304
h4 36,029
bridge 31,223
twentytwentyone 30,232
lightning 30,042
twentytwenty 28,737
swell 28,093
bricks 26,506
Impreza 26,020
Newspaper 24,226
twentytwentythree 22,108
epik-redesign 19,110
twentytwentytwo 18,755
uncode 18,456
pro 17,628
twentysixteen 17,587
sydney 16,328
storefront 16,300
Total 14,366
hello-theme-child-master 14,020
factory-templates-4 13,736
themify-ultra 12,930
extendable 12,681
hestia 12,550
yootheme 12,465
yith-wonder 12,081
porto 11,951
twentyfifteen 11,848