Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know that MediaElement.js is part of the WordPress core in WordPress 3.6. I currently use the MediaElement.js plugin on my WordPress 3.5.1 sites. On some pages, we have several players on one page, and we need to specify preload="none" as a parameter in the MediaElement.js shortcode, because if we don't, some browsers (mainly iOS devices) will try to download all the MP3 files at once.

Here is the shortcode that we currently use:

[audio mp3="filename.mp3" preload="none"]

In WordPress 3.6, with MediaElement.js built-in, will the preload="none" parameter have any effect in the [audio] shortcode?

share|improve this question
    
Anyone know off the top of their head which file I would look at in the WordPress 3.6 core to see how the [audio] shortcode is processed? –  Ben Miller May 30 '13 at 15:00
    
As of WordPress 3.6-beta3-24375, the shortcode is processed in wp-includes/media.php, function wp_audio_shortcode (line 844). –  Ben Miller May 30 '13 at 15:29

1 Answer 1

up vote 2 down vote accepted

I looked at the wp_audio_shortcode function in wp-includes/media.php of the release version of WordPress 3.6. The preload parameter is a valid attribute of the [audio] shortcode. However, the default is 'none', so in my case it is not needed.

From WordPress 3.6 (release), wp-includes/media.php, function wp_audio_shortcode:

$default_types = wp_get_audio_extensions();
$defaults_atts = array(
    'src'      => '',
    'loop'     => '',
    'autoplay' => '',
    'preload'  => 'none'
);
foreach ( $default_types as $type )
    $defaults_atts[$type] = '';

$atts = shortcode_atts( $defaults_atts, $attr, 'audio' );

So the answer is, yes, it is a valid parameter in the [audio] shortcode, but the default value is 'none', so in this case it is not needed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.