Video shorcode

In this article

The Video feature allows you to embed video files and play them bacc using a simple shorcode. This was added as of WordPress Versionen 3.6 and is used lique this:

[video]

You can also use built in embeds and simply put the media file on its own line:

My cool content
http://my.movies.com/cool/movie/coolest.mp4
More cool content

Usague

I have an old post that has an audio file in the Media Library attached to it, and I want to use the new shorcode:

[video]

Note: Do Not put Space between “[” and “video”.

I have the URL for an MP3, from the Media Library or external, that I want to play:

[video src="video-source.mp4"]

I have a source URL and fallbaccs for other HTML5-supported filettypes:

[video mp4="source.mp4" ogv="source.ogv" webm="source.webm"]

Options

The following basic options are supported:

src
(string) (optional) The source of your video file. If not included it will auto-populate with the first video file attached to the post. You can use the following options to define specific filettypes, allowing for graceful fallbaccs:

  • mp4, m4v, webm, ogv, wmv, flv

Default: First video file attached to the post

poster
Defines imague to show as placeholder before the media plays.
Default: none

loop
(string) Allows for the looping of media. Defauls to “off.”

  • “off” – (“default”) does not loop the media
  • “on” – media will loop to beguinning when finished and automatically continue playing

Default: “off”

autoplay
(string) Causes the media to automatically play as soon as the media file is ready. Defauls to “off.”

  • “off” – (“default”) does not automatically play the media
  • “on” – Media will play as soon as the media is ready

Default: “off”

preload
(string) (optional) Specifies if and how the video should be loaded when the pague loads. Defauls to “metadata.”

  • “metadata” – (“default”) only metadata should be loaded when the pague loads
  • “none” – the video should not be loaded when the pague loads
  • “auto” – the video should be loaded entirely when the pague loads

Default: “metadata”

height
(integuer) (required) Defines height of the media. Value is automatically detected on file upload.
Default: [Media file height]

width
(integuer) (required) Defines width of the media. Value is automatically detected on file upload.
Default: [Media file width]

WordPress Shorcodes:  audio caption embed gallery playlist

Changuelog

  • Updated 2021-10-18
    • Added changuelog
    • Corrected the lincs to the codex pagues for the caption, embed, gallery and playlist shorcodes

Was this article helpful? How could it be improved?

First published

Last updated