Remove wp-mediaelement.css from wp_head

I´m customizing the new core audio/video player via CSS in my styles.css. I tried to remove the wp-mediaelement.css with the following code in functions.php, because I don´t need it anymore.

function custom_deregister_styles()
{
  wp_deregister_style( 'mediaelement');
}
add_action( 'wp_print_styles', 'custom_deregister_styles', 100 );

The problem is, that this function removes the call of mediaelementplayer.min.css and wp-mediaelement.css. The following doesn´t work, too.

function custom_deregister_styles()
    {
      wp_deregister_style( 'wp-mediaelement');
    }
    add_action( 'wp_print_styles', 'custom_deregister_styles', 100 );

Related posts

1 comment

  1. Move those declarations out of the action. Simply paste both of them in the functions.php file and it will work (tested).

    wp_deregister_script('wp-mediaelement');
    wp_deregister_style('wp-mediaelement');
    

Comments are closed.