• I am using wp_audio_shortcode() in a plugin and it is appending ?_=1 or ?_=2 (and so on) to the source urls of all mp3 files on my page. It does not do this for wav or ogg files, only mp3s. I have no other plugins installed (other than the one I’m developing). Other audio players are able to play the same mp3 files just fine on the same page. I read through the source code for the wp_audio_shortcode and I cannot find anything in there that would cause this strange behavior. At any rate, it renders all mp3s unplayable. Ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter thomstark

    (@thomstark)

    I found out why it’s doing this, and it’s not because they’re mp3s. It’s because they have spaces in their filenames. It was just a coincidence that the only files with spaces in the names were mp3s.

    This is still a big problem though. Is there a way to fix this?

    Thread Starter thomstark

    (@thomstark)

    str_replace(‘ ‘,’%20’,$file) does the trick.

    Thread Starter thomstark

    (@thomstark)

    Great, now it doesn’t play filenames with underscores!

    Did you ever find out why the ?_=1 is being appended to mp3 urls? It’s happening for me too and I’m curious as to why it’s happening.

    Regarding this and WP 4.0

    Well.. I think the reason for it is because of something with caching (but I don’t understand why). If having multiple media-instances it adds a number, say for instance I add 10 videos to a single page it get ?_=1 up to ?_=10. I would LOVE a explanation from the WP-team regarding this.

    In my case I needed to edit this because when requesting a video (mp4) from Rackspace Cloud Files CDN it would slow down when using the URL with the querystring for some reason.

    Solution for video-uploads – You have to edit a core-function in WordPress.

    File: /wp-includes/media.php, row 1864;
    $url = add_query_arg( '_', $instances, $atts[ $fallback ] );

    Change to

    $url = $atts[ $fallback ];

    and remember; This change will be reset if updating wordpress.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_audio_shortcode() is adding "?_=1" to end of .mp3 file urls’ is closed to new replies.