I'm working on a new FM radio station website, I was trying to use the default WordPress Audio Widget to play their live audio stream. The problem was that the Insert from URL option doesn't accept .m3u8 URLs.

I've tried to insert the following URL: https://streamingcdn.alaan.tv/fm/fm/playlist.m3u8 but it showed the following error:

Looks like this isn’t the correct kind of file. Please link to an audio file instead.

So I tried to save the same URL but with .mp3 extension instead of .m3u8, then tried to change the URL in the wp_options table in the database, but it didn't work, and the whole widget was deleted.

Is there any way to extend the accepted file types of the WordPress Default Audio widget to accept the .m3u8 extension?

NOTE: WordPress uses the www.mediaelementjs.com in their audio and video players which supports HLS sources by default, so I assume the audio widget can run the .m3u8 URLs if we found a way to extend the accepted file types (currently are: .mp3, .m4a, .ogg, and .wav).


There is a filter, wp_audio_extensions, that should allow you to add m3u8 to the whitelist of allowed file extensions. Add this code to a child theme's functions.php file, or using a plugin like Code Snippets:

function wpse_341199_allow_m3u8_extension( $exts ) {
    $exts[] = 'm3u8';

    return $exts;
add_filter( 'wp_audio_extensions', 'wpse_341199_allow_m3u8_extension' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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