Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

The simplest way is to use Google’s official YouTube Subscribe Button in a WordPress Custom HTML block or HTML-capable widget. Add Google’s platform script, then a container with your channel name or channel ID. You can also use a plugin if you need automatic placement below embedded videos, a shortcode, or a block.

Method 1: Add Google’s button with Custom HTML

Google’s widget uses a small JavaScript file and a container with the g-ytsubscribe class. The container must include either data-channel (your channel name) or data-channelid (your channel ID). A channel ID is generally the safer choice because it uniquely identifies the channel.

1. Generate the button code

  1. Open Google’s YouTube Subscribe Button configuration tool.
  2. Enter your channel name or channel ID.
  3. Choose the layout, theme, and subscriber-count display.
  4. Preview the result and copy the generated code.

Google documents these options:

Setting Available values Effect
Layout default, full Changes the button presentation.
Theme default, dark Applies the light or dark widget styling.
Subscriber count default, hidden Shows or hides the displayed subscriber count.

2. Insert it in WordPress

  1. Edit the page or post where the button should appear.
  2. Add a Custom HTML block.
  3. Paste the script and widget container.
  4. Replace the sample channel value with your own channel name or ID.
  5. Preview, publish, and check the result on desktop and mobile.

This is the minimal documented implementation:

<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channel="YOUR_CHANNEL_NAME" data-layout="default" data-count="default"></div>

For a channel ID, use this container instead:

<div class="g-ytsubscribe" data-channelid="UC..." data-layout="default" data-count="default"></div>

The button is dynamically sized, so do not design a layout around a guaranteed fixed width. When clicked, it opens the channel page in a new window so the visitor can confirm the subscription.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Method 2: Use a WordPress plugin

A plugin is useful when you want automatic placement, a shortcode, a Gutenberg block, or site-wide controls instead of editing HTML manually.

Subscribe Button Bar for YouTube Embed Videos

  1. In WordPress, go to Plugins → Add New.
  2. Search for Subscribe Button Bar for YouTube Embed Videos and install and activate it.
  3. Open Settings → Subscribe Button Bar.
  4. Enter a channel ID, @handle, or channel URL and choose the layout, theme, and count visibility.

The plugin can detect YouTube videos in posts and pages and add a subscribe bar beneath them. It also provides the [subscribe_button_bar] shortcode and a Gutenberg block for more deliberate placement.

Easy Subscribe Button Widget

Easy Subscribe Button Widget is another WordPress.org option. Its documented controls include full-layout display, subscriber-count visibility, and channel names or IDs. It loads YouTube’s platform script when the widget renders, allowing you to place the button through a widget area rather than pasting code into each post.

Direct code or plugin: which should you choose?

Consideration Google code Plugin
Setup effort Paste the script and container once per placement. Install, activate, configure, then use automatic placement, a shortcode, a block, or a widget.
Plugin dependency None. Depends on the plugin remaining compatible and maintained.
Placement automation Manual placement in HTML areas or templates. Can place bars beneath detected YouTube videos or through site-wide settings.
Markup control Direct control over the widget container and its documented attributes. Convenient controls, with styling and output determined partly by the plugin.
Channel identifiers Channel name or channel ID. Depends on the plugin; the documented options above support names, IDs, handles, or URLs.
Privacy and maintenance Loads Google’s platform script wherever you place it. May add an external script and may transmit visitor IP address or user-agent data to Google; review the plugin’s current privacy disclosure before activation.

Use Google’s direct code when you want fewer dependencies and precise control. Use a plugin when automatic placement or block, shortcode, and widget support saves meaningful time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

YouTube video embeds are not subscribe buttons

WordPress’s core YouTube Embed block embeds a video; it does not add a channel subscription control. The video publisher must allow embedding. WordPress also notes that non-personal identifying viewing data is shared with YouTube and the publisher. Add the separate Subscribe Button widget if your goal is to let visitors subscribe to the channel.

Troubleshoot a missing button

  • Nothing appears: confirm that https://apis.google.com/js/platform.js is present and that the code is inside a Custom HTML-capable block, widget, or template area.
  • Wrong or empty channel: check the channel name or, preferably, the complete channel ID beginning with UC.
  • Code displays as text: move it from a paragraph or visual editor into a Custom HTML block or another HTML-capable area.
  • Unexpected appearance: verify the data-layout, data-theme, and data-count values against Google’s documented options. The widget’s width is dynamic.
  • Event-based customizations: do not build new functionality around the widget’s subscribe or unsubscribe events; Google documents both events as deprecated.
  • Plugin concerns: check the plugin’s current compatibility, update history, and privacy disclosure before enabling it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Compliance and privacy notes

Any implementation that uses YouTube’s widget or a plugin that loads it should follow YouTube’s API Terms of Service and related monetization and branding requirements. A plugin can introduce additional data processing, so review its current privacy information and explain the third-party script in your site’s privacy documentation where required.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.