wp_audio_shortcode

SummerySummery

Builds the Audio shortcode output.

Syntax

wp_audio_shortcode( array $attr, string $content = '' )

DescriptionDescription

This implements the functionality of the Audio Shortcode for displaying WordPress mp3s in a post.

ParametersParameters

$attr

(array) (Required) Attributes of the audio shortcode.

  • 'src'
    (string) URL to the source of the audio file. Default empty.
  • 'loop'
    (string) The 'loop' attribute for the <audio> element. Default empty.
  • 'autoplay'
    (string) The 'autoplay' attribute for the <audio> element. Default empty.
  • 'preload'
    (string) The 'preload' attribute for the <audio> element. Default 'none'.
  • 'class'
    (string) The 'class' attribute for the <audio> element. Default 'wp-audio-shortcode'.
  • 'style'
    (string) The 'style' attribute for the <audio> element. Default 'width: 100%;'.

$content

(string) (Optional) Shortcode content.

Default value: ''

ReturnReturn

(string|void) HTML content to display audio.

SourceSource

File: wp-includes/media.php


			

ChangelogChangelog

Changelog
Version Description
3.6.0 Introduced.
Scroll to Top