{"id":10840101,"date":"2018-11-02T04:23:13","date_gmt":"2018-11-02T04:23:13","guid":{"rendered":"https:\/\/wordpress.org\/support\/?post_type=helphub_article&#038;p=10840101"},"modified":"2023-01-11T13:57:20","modified_gmt":"2023-01-11T13:57:20","slug":"audio-shortcode","status":"publish","type":"helphub_article","link":"https:\/\/wordpress.org\/documentation\/article\/audio-shortcode\/","title":{"rendered":"Audio Shortcode"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ audio]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Do not put space between \u201c[\u201d and \u201caudio\u201d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also use build-in embeds and simply put the media file on its own line:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">My cool content<br \/>http:\/\/my.mp3s.com\/cool\/songs\/coolest.mp3<br \/>More cool content<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Usage<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ audio]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Do Not put Space between \u201c[\u201d and \u201caudio\u201d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have the URL for an MP3, from the Media Library or external, that I want to play:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[audio src=\"audio-source.mp3\"]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I have a source URL and fallbacks for other HTML5-supported filetypes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[audio mp3=\"source.mp3\" ogg=\"source.ogg\" wav=\"source.wav\"]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Options<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The following basic options are supported:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>src<\/code><br \/>(<a href=\"https:\/\/wordpress.org\/documentation\/article\/glossary\/#string\">string<\/a>) (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:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8216;mp3&#8217;, &#8216;m4a&#8217;, &#8216;ogg&#8217;, &#8216;wav&#8217;, &#8216;wma&#8217;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Default: First audio file attached to the post<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>loop<\/code><br \/>(<a href=\"https:\/\/wordpress.org\/documentation\/article\/glossary\/#string\">string<\/a>) (optional) Allows for the looping of media.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8220;off&#8221; &#8211; Do not loop the media.<\/li>\n\n\n\n<li>&#8220;on&#8221; &#8211; Media will loop to the beginning when finished and automatically continue playing.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Default: &#8220;off&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>autoplay<\/code><br \/>(<a href=\"https:\/\/wordpress.org\/documentation\/article\/glossary\/#string\">string<\/a>) (optional) Causes the media to automatically play as soon as the media file is ready.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8220;off&#8221; &#8211; Do not automatically play the media.<\/li>\n\n\n\n<li>&#8220;on&#8221; &#8211; Media will play as soon as it is ready.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Default: &#8220;off&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>preload<\/code><br \/>(<a href=\"https:\/\/wordpress.org\/documentation\/article\/glossary\/#string\">string<\/a>) (optional) Specifies if and how the audio should be loaded when the page loads. Defaults to &#8220;none&#8221;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8220;none&#8221; &#8211; The audio should not be loaded when the page loads.<\/li>\n\n\n\n<li>&#8220;auto&#8221; &#8211; The audio should be loaded entirely when the page loads.<\/li>\n\n\n\n<li>&#8220;metadata&#8221; &#8211; Only metadata should be loaded when the page loads.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Default: &#8220;none&#8221;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"> WordPress Shortcodes:&nbsp;<a href=\"https:\/\/wordpress.org\/documentation\/article\/video-shortcode\/\">video<\/a>,&nbsp;<a href=\"https:\/\/codex.wordpress.org\/Caption_Shortcode\">caption<\/a>,&nbsp;<a href=\"https:\/\/codex.wordpress.org\/Embed_Shortcode\">embed<\/a>,&nbsp;<a href=\"https:\/\/codex.wordpress.org\/Gallery_Shortcode\">gallery<\/a>,&nbsp;<a href=\"https:\/\/codex.wordpress.org\/Playlist_Shortcode\">playlist<\/a><\/p>\n\n\n\n<div class=\"wp-block-group changelog has-background is-layout-flow wp-block-group-is-layout-flow\" style=\"background-color:#e0e0e0\">\n<h4 class=\"wp-block-heading\" id=\"changelog\"><strong>Changelog <\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Updated 2021-10-18\n<ul class=\"wp-block-list\">\n<li>Added changelog<\/li>\n\n\n\n<li>Corrected the links to the codex pages for the caption, embed, gallery and playlist shortcodes<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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: [ audio] Note: Do not put space between \u201c[\u201d and \u201caudio\u201d. You can also use build-in embeds and simply put the media file on its own [&hellip;]<\/p>\n","protected":false},"author":8933097,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false},"category":[87,78],"class_list":["post-10840101","helphub_article","type-helphub_article","status-publish","hentry","category-media","category-support-guides"],"revision_note":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles\/10840101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles"}],"about":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/types\/helphub_article"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/comments?post=10840101"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles\/10840101\/revisions"}],"predecessor-version":[{"id":16355091,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/articles\/10840101\/revisions\/16355091"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wporg\/v1\/users\/howdy_mcgee"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/media?parent=10840101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.org\/documentation\/wp-json\/wp\/v2\/category?post=10840101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}