MemberPress loads theme.css
globally all the time so that the login form can work on any page.
https://example.com/wp-content/plugins/memberpress/css/ui/theme.css?ver=1.8.7
If you are going to have the login form on a specific Page say “Login” then you don’t need to have theme.css load sitewide.
The following code snippet will dequeue theme.css
file of MemberPress globally and conditionally loads it on a Page whose slug is login
:
add_action( 'wp_enqueue_scripts', 'custom_unload_memberpress_theme_css', 100 );
/**
* Dequeue /css/ui/theme.css from MemberPress plugin and load it on a specific Page.
*/
function custom_unload_memberpress_theme_css() {
wp_dequeue_style( 'mp-theme' );
if ( is_page( 'login' ) ) {
wp_enqueue_style( 'mp-theme', MEPR_CSS_URL . '/ui/theme.css', null, MEPR_VERSION );
}
}
To make the file load on multiple pages, set the if condition like like so:
if ( is_page( array( 'login', 'membership', 'join' ) ) )
If you are using the Code Snippets plugin for managing your snippets, you can set the above to run only on the frontend.
Reference: /wp-content/plugins/memberpress/app/controllers/MeprAppCtrl.php.