How to embed a video in WordPress without YouTube

Show a video in a WordPress post or page without YouTube's suggested videos. Works with the block editor, the classic editor, Elementor and other page builders.

yourblog.com/our-trip 4K <iframe src="vidlify.to/e/…" allowfullscreen ></iframe>

WordPress can host videos itself, but large video files slow down your server and play badly on slow connections. YouTube solves that, but shows suggested videos from other channels and sends your visitors away. The middle way: host the video on a video host and embed it with one line of code.

Before you start

You need the video uploaded to Vidlify (free with 30 GB of storage) and its embed code. Open the video, scroll to Share and embed and copy one of the two versions:

  • Responsive: fills the width of the column and keeps the 16:9 shape. Best for most themes.
  • Fixed size: a plain iframe with width and height.

Block editor (Gutenberg)

  1. Open the post or page and click + where the video should go.
  2. Search for Custom HTML and add the block.
  3. Paste the embed code.
  4. Click Preview in the block to check it, then update the post.

Classic editor

  1. Switch from Visual to Text (the tab at the top right of the editor).
  2. Paste the embed code where the video should appear.
  3. Update the post. Don't switch back to Visual before saving, the visual editor can change the code.

Elementor and other page builders

  • Elementor: drag the HTML widget into the section and paste the code.
  • Divi: use a Code module.
  • Other builders: look for an element called HTML, Code or Embed.

Useful options

Add these to the address in the src attribute:

  • ?t=30 starts the video at second 30
  • ?autoplay=1&muted=1 starts it automatically, muted (why muted)

Keep the video on your site

Anyone can copy an embed code from your page source. To make sure your video only plays on your website, enter your domain in the video's settings under Allow embedding only on these domains (how the domain lock works).

Troubleshooting

  • The block shows the code as text: you used a Paragraph block. Use Custom HTML instead.
  • The video is tiny or cut off: use the responsive version of the code.
  • The video doesn't load on your site: check the domain lock in the video's settings. Your domain must be on the list, written like mysite.com.
  • Security plugins remove the iframe: some plugins strip iframes for users without the unfiltered HTML permission. Paste the code as an administrator.

Other website builders

Share this article

Keep reading