How to import liked YouTube videos into WordPress

If you visit my personal website you will notice the homepage is setup to show a random video I liked on YouTube.

I’ve also given my my liked videos their own page so you can see what videos I’ve liked in chronological order.

Here take a look at these screenshots. They’ll show you how both sections look:

Homepage — Source: hudsonatwell.co/
Archive Page — Source: hudsonatwell.co/liked-videos/

I love using YouTube as a curation tool and I never quite know what I want to do on my personal site.

Because music is such a big part of my life, I want to share my findings along side my software projects and business mentions. Doing this makes my site more entertaining to visit (for me at least).

Before I dive into deeper explanation on how I import likes, it’s important to point out that not everyone uses their like button to curate music. That’s just how I use it. Having an import tool like the one I’m about to mention below will open the YouTube like button to be used in different imaginative ways. You can easily spin up new YouTube accounts for unique curation experiences.

How I Import Liked Videos into WordPress

To import liked videos into WordPress I built an asset that accesses the YouTube API, regularly via cron, and imports liked content into a WordPress custom post type.

You can find my project’s GitHub repository here, for downloads and contributions.

Setting up the plugin

There are very minimal requirements to setting this plugin up. Have look below at the settings area and the place where we store imported videos:

Liked videos imported over time

Though this asset is great at importing, it doesn’t really come with any front end features. Front end integration requires a few manual steps, and depending on how far you want to take it, maybe some custom coding as well.

Linking to liked videos

Once the plugin is setup and importing videos into a custom post type, you can link directly to that post-type’s archive by adding the following permalink name onto to your website’s base URL: /liked-videos/

So for quick and easy access to an archive, the full like will look like this:

https://hudsonatwell.co/liked-videos/

Custom Front-end Styling

In order to create custom styling, consider creating an archive template for the liked-videos custom post type.

Here’s an example of my website’s custom archive page’s PHP code:

Note: archive-liked-videos.php is basically a clone of my WordPress theme’s archive.php file. This file normally sits inside the theme’s base directory. That’s also where we will create our new file archive-liked-videos.php.

You most likely will not want to use the code I have above. Instead, find your own theme’s archive.php file in your theme’s base directory file; copy, paste & modify that file’s contents into a new file called archive-liked-videos.php.

Another thing you may be wondering is, “How did you add a rotating video to your homepage?

How I added a rotating liked video to my homepage:

In order to add the random video embed to my homepage I used PHP to create a WordPress shortcode that looks like this: [latest-video].

I then added the above shortcode to my homepage’s content area.

Here’s the PHP code I wrote to support the shortcode [latest-video] and allow it to be used inside of content:

Please note: The above PHP code should be placed inside your theme’s functions.php file or into a custom plugin. Once there you should be able to use the [latest-video] shortcode anywhere in your website that supports shortcodes. And that’s it!

Like my taste in music? Stay tuned in!

Now that our liked videos are stored into a WordPress custom post type, we can begin to make use of WordPress’s RSS features and generate a link to a RSS feed of our liked videos whenever we want.

Here’s a link to the RSS Feed of my liked videos. To create your own just head into your /liked-videos/ archive page and add /feed/ to the end. Your end URL will look something like this:

If you plug the above into your favorite RSS Reader then you can always get notified every time I like a new video on YouTube. I use Feedly as an RSS Reader.


Thank you for reading this article! I sell very powerful & effective WordPress plugin products and take on contracting gigs through the Codeable.io Agency.

My latest product is a collaboration project called TweetBoostPRO, a tool that helps WordPress administrators schedule tweet variations for every piece of content on their website.

Claps will send this story more attention. If you clap for it, consider clapping as long as you would if you were really clapping out loud.

Thanks again for reading!