wp_get_audio_extensions()WP 3.6.0

Gets an array of audio formats supported in WordPress. Gets file extensions.

By default the supported formats are: mp3, ogg, wma, m4a, wav.

The extensions returned by this function are used when auto-embedding audio in posts. When a post contains a link to an audio file on its own line...

To get video extensions, use wp_get_video_extensions()

Hooks from the function

Returns

String[]. Array of supported audio file extensions.

Usage

wp_get_audio_extensions();

Examples

0

#1 Get all the extensions of supported audio files

$audio_extensions = wp_get_audio_extensions();

/*
$audio_extensions will be equal:

Array
(
	[0] => mp3
	[1] => ogg
	[2] => wma
	[3] => m4a
	[4] => wav
)
*/

Changelog

Since 3.6.0 Introduced.

wp_get_audio_extensions() code WP 6.8.3

function wp_get_audio_extensions() {
	/**
	 * Filters the list of supported audio formats.
	 *
	 * @since 3.6.0
	 *
	 * @param string[] $extensions An array of supported audio formats. Defaults are
	 *                            'mp3', 'ogg', 'flac', 'm4a', 'wav'.
	 */
	return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'flac', 'm4a', 'wav' ) );
}