Skip to content

Instantly share code, notes, and snippets.

@uxmoon
Created March 4, 2023 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uxmoon/ab9357237f12260e957b338c0d23f1e2 to your computer and use it in GitHub Desktop.
Save uxmoon/ab9357237f12260e957b338c0d23f1e2 to your computer and use it in GitHub Desktop.
Remove MailPoet CSS files
<?php
// Force removal of styles
add_filter('print_styles_array', 'custom_print_styles_array');
/**
* Force removal of styles that are not enqued properly
*/
function custom_print_styles_array($styles){
$styles_to_remove = array(
'mailpoet_public', // plugins/mailpoet
'mailpoet_custom_fonts_css' // plugins/mailpoet
);
if(is_array($styles) && count($styles) > 0){
foreach($styles as $key => $code){
if(in_array($code, $styles_to_remove)){
unset($styles[$key]);
}
}
}
return $styles;
}
/**
* Source: https://wordpress.org/support/topic/remove-stylesheet-3/
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment