YouTube-2-Post
Imports YouTube channel videos, Shorts and live streams as WordPress posts, with a title, description, thumbnail, category and player.

Videos, Shorts, live streams, scheduled streams and recorded streams each use their own status, category and rule. Stream status takes precedence over duration, so a short live stream does not become a Short.
The post displays a thumbnail and a play button. The YouTube iframe is only created on click or when consent has already been granted through the WP Consent API or an event from the consent manager.
Fetching runs through a queue in short batches, with a lock against duplicate runs, a daily quota limit and scheduling from 15 minutes. When the quota or server time runs out, processing resumes in the next cycle.
The plugin writes only inside marked regions in the post. Content added by the editor outside those regions stays in place after each resync.
Deleted, private or rejected videos become drafts (or private posts, trashed posts or flagged posts). The post is published again if the video returns, while respecting manual decisions made by the editor.
The widgets display videos in a grid or list, with filters for type, channel, category and tag, or display a single video. Clicking opens the post, opens YouTube or plays the video inside the widget.
YouTube videos as posts
I built YouTube-2-Post for people who publish videos on YouTube and want the same collection in WordPress without copying each title, description and thumbnail manually. With a YouTube Data API key and channels (ID, @handle or URL), each video becomes a post with a title, description, excerpt, thumbnail as the featured image, category, tags and player.
The post uses the video's YouTube publication date and stores the video ID in a dedicated field. The plugin uses this field to track videos already imported.
YouTube channel
↓
Work queue (50 videos per page)
↓
Only videos not on the site yet
↓
Post with player, description, thumbnail and tagsRules for each video format
The plugin classifies each video before importing it. For each format you turn importing on or off and choose the post status (published, draft, pending or private) and the category.
| Format | How it is detected | Default |
|---|---|---|
| Video | Regular upload | Imported as published |
| Short | Duration within the limit (180 s by default), confirmed on youtube.com/shorts, or the #shorts hashtag, depending on the selected detection method | Imported as draft |
| Live | Stream in progress | Off |
| Scheduled | Live stream or premiere with a scheduled date | Off |
| Recorded stream | Ended stream, which can also be treated as a regular video | Imported as published |
Stream status takes precedence over duration: a two-minute live stream is still a live stream. Active live streams and premieres are checked again every 15 minutes. When they end, the same post follows the recorded stream rule.
Queued sync
Fetching reads each channel's uploads playlist in pages of 50 videos. A single query compares the page's IDs with videos already stored on the site. Metadata for new videos is fetched in batches of 50. Processing runs in short batches, with a time limit per run (20 seconds by default), and stops before reaching the PHP memory limit.
- Incremental (default): stops at the first page with no new videos and uses 1 quota unit per channel when there are no new videos.
- Full scan: scans the entire history and rechecks the videos that were skipped before.
- Scheduled: every 15 minutes, 30 minutes, hour, twice a day or once a day, through WP-Cron.
- Manual: from the admin screen or through WP-CLI, which has no request time limit and suits the first import of large channels.
If a run is interrupted, progress is preserved. Deduplication uses the video ID stored in each post, so the next cycle resumes where processing stopped. A quota or key error pauses the queue and retries in 15 minutes. An individual failure is retried up to 3 times before the job is discarded and logged.
API quota
Google provides 10,000 units per day per key. The plugin never uses search.list (100 units per call). It only calls playlistItems.list, videos.list and channels.list, at 1 unit each. The admin displays daily usage, and sync pauses automatically at the configured limit.
Resync that preserves editor content
Generated content stays inside regions marked by HTML comments. Resync replaces only the content inside them. Anything the editor wrote before, after or between the regions remains. Reapplying the import produces exactly the same content.
Editor text, before <!-- heroyt:player:ID --> … <!-- /heroyt:player --> <!-- heroyt:description --> … <!-- /heroyt:description --> Editor text, after
Posts from version 1.x with a plain iframe are converted to the consent-based player once, replacing the old embed. No videos are reimported. In the posts list, the Ressincronizar do YouTube (Resync from YouTube) action updates a specific video.
Consent-based player (LGPD)
A standard YouTube iframe contacts Google's servers when the page opens. The default mode, called a facade, displays the thumbnail stored on the site and a play button. The iframe is created on click or loaded without playback when consent has already been granted.
- Uses the
youtube-nocookie.comdomain by default. - Automatic integration with the WP Consent API, using the configured consent category (marketing by default).
- Any other consent platform can enable the player with an event:
document.dispatchEvent(new Event('heroyt-consent-granted')). - Editable privacy notice with a link to the site's privacy policy.
- Link to watch on YouTube when JavaScript is disabled.
- Optional direct mode with a standard iframe.
The site publisher is responsible for the privacy policy and the legal basis for processing personal data.
Unavailable videos
A separate check, daily by default, confirms that each imported video is still available. Deleted, private or rejected videos get the action configured for the post, which by default turns it into a draft so the site does not promote a video nobody can watch. Checking the whole collection costs 1 quota unit per 50 videos.
- Convert to draft (default)
- Make private
- Move to trash
- Flag only, without changing the post
The action is idempotent. The original status is stored, and the plugin acts only once in each case. When a video returns, it only republishes posts it unpublished itself. If the editor changes the status manually, that decision is respected. Embedding blocked by the author only flags the video, since the video still exists and the post remains published.
The posts list includes a YouTube column and filters for type and availability.
Elementor widgets
When Elementor is active, two widgets are available in the HeroYT: YouTube category. Importing and publishing work independently of Elementor.
“Vídeos do YouTube (lista/grade)”: list and grid
- Grid with columns per device, or list with the image on the left or right.
- Filter by type (only Shorts, only live streams or any combination), channel, category and tag, or select videos manually.
- Sort by date, title, duration, last update, manual order or random order, with pagination.
- Enable elements individually: image, play button, badge, duration, title, excerpt, date, channel and button.
- Clicking opens the post, opens YouTube or plays the video in place with the consent-based player.
- Style controls for cards, media, badges, text and buttons.
“Vídeo do YouTube (único)”: single video
Displays the current post's video in single-post templates, a selected video or the latest video matching a set of filters. The aspect ratio is automatic, with 9:16 for Shorts. Title, badge, duration, date and link are optional. The player, play button and privacy notice have separate style controls.
The list and the latest video matching the filters hide videos that the availability check marked as deleted or private.
Admin and command line
The YouTube to Post menu contains five screens: Sincronização (Sync), with active channels, imported videos, quota used today, the next sync and buttons to sync, run a full scan, check availability, test the connection and cancel; Configurações (Settings), Licença (License), Registro (Log) and Documentação (Documentation).
The Configurações (Settings) screen covers the YouTube connection, channels, publishing, privacy, rules for each video type, ended streams, Shorts detection and sync.
wp heroyt sync # incremental sync wp heroyt sync --full # full scan wp heroyt validate # check availability wp heroyt status # queue, quota and schedules wp heroyt reset # clear queue, lock and log
Extension points
The 13 hooks, consisting of 11 filters and 2 actions, allow changes to the detected type, the post before saving, content and tags, player HTML and widget query arguments. They also allow adjustments to the time per batch, required capability and allowed thumbnail domains, and actions when a post is created or updated.
Each imported post stores metadata with the _heroyt_ prefix (type, duration, stream status, channel, dates). The videoID field, retained from version 1, identifies videos already imported.
Requirements
- WordPress 6.0 or later and PHP 7.4 or later.
- A YouTube Data API v3 key created in Google Cloud.
- Working WP-Cron or a server cron job calling wp-cron.php for automatic sync.
- A server with outbound HTTPS access to Google and YouTube and a writable uploads directory for thumbnails.
- Elementor and WP Consent API are optional.
- The admin screens are mostly in Portuguese, with part of the texts translated into English.
Uninstalling removes the plugin's options and scheduled jobs and keeps imported posts.
How it was built
Class-based PHP plugin with no third-party dependencies. The API client, queue, classifier, player, validator and widgets are all custom code. Elementor and WP Consent API are optional integrations detected at runtime.