video embed example

Embedding video in WordPress sites

The short answer: don’t use plugins for embedding YouTube/Vimeo/etc. videos

In a page or post:

Either paste its URL on its own line or use the embed shortcode. From the codex:

For example:

WordPress will automatically turn the URL into a YouTube embed and provide a live preview in the visual editor.

Another option is to wrap the URL in the embed shortcode:

If WordPress fails to embed the URL, the post will contain a hyperlink to the URL.

In a text widget (e.g., for display in a sidebar) use the video shortcode

But since the text widget doesn’t support shortcodes by default, add, in functions.php, the following code from Stack Overflow:

Then use the video shortcode:

One thought on “Embedding video in WordPress sites”

Comments are closed.