Latest YouTube Playlist Video Block
A WordPress block that displays the latest video from a YouTube playlist with no API key required. The thumbnail is saved to the local media library, and results are cached hourly to avoid repeated external fetching.
by david wolfpaw · github.com/davidwolfpaw/latest-youtube-playlist-video
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/davidwolfpaw/latest-youtube-playlist-video/archive/refs/heads/main.zipA WordPress block that displays the latest video from a YouTube playlist with no API key required. The thumbnail is saved to the local media library, and results are cached hourly to avoid repeated external fetching.
Features
- Fetches the most recent video from any public YouTube playlist via RSS (no YouTube Data API key needed)
- Saves the thumbnail to your local media library so no third-party images are served to visitors
- Responsive image output with WordPress generated
srcsetandsizes - Two layouts: stacked (thumbnail above text) or columns (thumbnail left, text right)
- Configurable thumbnail resolution, title/excerpt display, typography, and link behavior
- Results cached with transients; thumbnails stored in the media library
Requirements
- WordPress 6.0+
- PHP 8.0+
- A public YouTube playlist (private playlists are not accessible via RSS)
Installation
- Upload the
latest-youtube-playlistfolder towp-content/plugins/. - Activate the plugin under Plugins → Installed Plugins.
- Add the Latest YouTube Playlist Video block from the block inserter.
Usage
- Open the block's Playlist Settings panel in the sidebar.
- Paste your YouTube playlist ID — the
list=value from the playlist URL (e.g.PLxxxxxxxxxxxxxx). - Adjust layout, thumbnail size, and typography options as needed.
How it works
The plugin reads YouTube's public Atom feed (youtube.com/feeds/videos.xml?playlist_id=…), finds the most recently published entry, and caches the result for one hour. On the first frontend render after a cache miss the thumbnail is sideloaded into your WordPress media library; subsequent renders serve the local copy with a full responsive srcset.
The block editor preview loads the thumbnail directly from YouTube's image CDN for speed. Only the published front-end output uses the local copy.
Caching
| Data | Storage | TTL |
|---|---|---|
| Playlist feed (video metadata) | Transient | 1 hour |
| Thumbnail attachment ID | Transient + media library | 1 week |
To force a feed refresh, delete the lyp_latest_* transients with a transient-manager plugin or via WP-CLI:
wp transient delete --search="lyp_latest_"