Created
March 4, 2023 19:22
-
-
Save uxmoon/ab9357237f12260e957b338c0d23f1e2 to your computer and use it in GitHub Desktop.
Remove MailPoet CSS files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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