The Audio feature allows you to embed audio files and play them back using a simple Shortcode. This was added as of WordPress 3.6 and is used like this:
Note: Do not put space between “[” and “audio”.
You can also use build-in embeds and simply put the media file on its own line:
My cool content
More cool content
I have an old post that has an audio file in the Media Library attached to it, and I want to use the new shortcode:
Note: Do Not put Space between “[” and “audio”.
I have the URL for an MP3, from the Media Library or external, that I want to play:
I have a source URL and fallbacks for other HTML5-supported filetypes:
The following basic options are supported:
(string) (optional) The source of your audio file. If not included it will auto-populate with the first audio file attached to the post. You can use the following options to define specific filetypes, allowing for graceful fallbacks:
- ‘mp3’, ‘m4a’, ‘ogg’, ‘wav’, ‘wma’
Default: First audio file attached to the post
(string) (optional) Allows for the looping of media.
- “off” – Do not loop the media.
- “on” – Media will loop to the beginning when finished and automatically continue playing.
(string) (optional) Causes the media to automatically play as soon as the media file is ready.
- “off” – Do not automatically play the media.
- “on” – Media will play as soon as it is ready.
(string) (optional) Specifies if and how the audio should be loaded when the page loads. Defaults to “none”
- “none” – The audio should not be loaded when the page loads.
- “auto” – The audio should be loaded entirely when the page loads.
- “metadata” – Only metadata should be loaded when the page loads.
WordPress Shortcodes: video, caption, embed, gallery, playlist
- Updated 2021-10-18
- Added changelog
- Corrected the links to the codex pages for the caption, embed, gallery and playlist shortcodes
Was this article helpful? How could it be improved?
Log in to submit feedback. If you need suppport with something that wasn't covered by this article, please post your question in the support forums.