Here’s the code for anyone who’s interested:
// improve performance by deregistering ultimate member css/js on pages
// that don't need them
add_action( 'wp_print_scripts', 'my_deregister_ultimate_member_javascript', 100 );
add_action( 'wp_print_styles', 'my_deregister_ultimate_member_styles', 100 );
function on_ultimate_member_page() {
$um_option = get_option( 'um_options' );
if ( !$um_option ) {
return false;
}
$um_page = array( $um_option['core_user'],
$um_option['core_login'],
$um_option['core_register'],
$um_option['core_members'],
$um_option['core_logout'],
$um_option['core_account'],
$um_option['core_password-reset']
);
if ( is_page( $um_page ) ) {
return true;
} else {
return false;
}
}
function my_deregister_ultimate_member_styles() {
if ( on_ultimate_member_page() )
return;
wp_deregister_style( 'um_fonticons_ii' );
wp_deregister_style( 'um_fonticons_fa' );
wp_deregister_style( 'um_crop' );
wp_deregister_style( 'um_tipsy' );
wp_deregister_style( 'um_raty' );
wp_deregister_style( 'select2' );
wp_deregister_style( 'um_fileupload' );
wp_deregister_style( 'um_datetime' );
wp_deregister_style( 'um_datetime_date' );
wp_deregister_style( 'um_datetime_time' );
wp_deregister_style( 'um_scrollbar' );
wp_deregister_style( 'um_rtl' );
wp_deregister_style( 'um_default_css' );
wp_deregister_style( 'um_modal' );
wp_deregister_style( 'um_responsive' );
wp_deregister_style( 'um_styles' );
wp_deregister_style( 'um_members' );
wp_deregister_style( 'um_profile' );
wp_deregister_style( 'um_account' );
wp_deregister_style( 'um_account' );
wp_deregister_style( 'um_old_css' );
}
function my_deregister_ultimate_member_javascript() {
if ( on_ultimate_member_page() )
return;
wp_deregister_script( 'select2' );
wp_deregister_script( 'um_scrollbar' );
wp_deregister_script( 'um_jquery_form' );
wp_deregister_script( 'um_fileupload' );
wp_deregister_script( 'um_datetime' );
wp_deregister_script( 'um_datetime_date' );
wp_deregister_script( 'um_datetime_time' );
wp_deregister_script( 'um_datetime_legacy' );
wp_deregister_script( 'um_datetime_locale' );
wp_deregister_script( 'um_tipsy' );
wp_deregister_script( 'um_raty' );
wp_deregister_script( 'um_crop' );
wp_deregister_script( 'um_modal' );
wp_deregister_script( 'um_responsive' );
wp_deregister_script( 'um_functions' );
wp_deregister_script( 'um-gdpr' );
wp_deregister_script( 'um_conditional' );
wp_deregister_script( 'um_scripts' );
wp_deregister_script( 'um_members' );
wp_deregister_script( 'um_profile' );
wp_deregister_script( 'um_account' );
wp_deregister_script( 'um_gchart' );
}