Skip to content

Snippet: How to Disable the WP Audio & Video Media Players

By default WordPress loads custom scripts that modify HTML5 (self-hosted) video and audio elements inserted into your posts with a custom design. This is really just added bloat and was originally added to provide support for these players across all browsers, but it's no longer needed. It is recommended to disable these custom scripts and render your video and audio elements using native browser players.

/**
 * Disable the WP Audio & Video Media Players.
 *
 * @link https://total.wpexplorer.com/docs/snippets/dequeue-wp-mediaelement/
 */
add_action('wp_enqueue_scripts', function(){
	wp_deregister_script( 'wp-mediaelement' );
	wp_deregister_style( 'wp-mediaelement' );
}, PHP_INT_MAX );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top