Resolving WP-Engine Style Sheet Conflicts

If your WordPress website is hosted by WP-Engine (https://wpengine.com/) you will find that the email editor window doesn’t appear when you click to edit or is pushed off the side of the screen. This is caused by a plugin that WP-Engine loads on all of its sites. Their plugin loads a style sheet on every admin page of your site and some of those styles conflict with ours.

For shame WP-Engine! You shouldn’t be loading styles except where needed. Fortunately, you can easily correct this by adding the following snippet of code to your theme’s functions.php file. It will simply dequeue (unload) their style sheet when you are on one of our plugin’s admin pages.

/**
 * Dequeue the wpe-common.css file that WP-Engine loads on every admin
 * screen if we're editing an email to prevent conflicts
 */
add_action('admin_enqueue_scripts', 'remove_css_conflict');
 
function remove_css_conflict($hook){
            global $post;
            if( (in_array($hook, array('post-new.php', 'post.php')) && isset($post) && $post->post_type == 'imc_email_campaign') || $hook == 'toplevel_page_integral_mailchimp/generaladmin.php') {
                        wp_dequeue_style( 'wpe-common' );
            }
}