WP Forms css code removal script


#1

Hello Friends,

I want to remove Two CSS files by WP-Forms which is necessary only on the particular page.
The page is https:// www. domainname.com/order-now

Script URL

https:// www. domainname.com/wp-content/plugins/wpforms/assets/css/jquery.timepicker.css
https:// www. domainname.com/wp-content/plugins/wpforms/assets/css/flatpickr.min.css
function wpformscss_dequeue() {
    //set to false so that you have something to check against
	$check_wpformstimepicker = false;
	if( is_page('order-now')) {
        	$check_wpformstimepicker = true;
    }
	//so therefore dequeue only if is false 
    if( !$check_wpformstimepicker ) {
        wp_dequeue_style( 'jquery.timepicker.css' );
        wp_dequeue_style( 'flatpickr.min.css' );
    }
}
add_action( 'wp_enqueue_scripts', 'wpformscss_dequeue', 77 );

Kindly help me to fix the bug in this script.


#2

Not sure about it.

Try a different plugin: Perfmatters (Premium), this can help in removing code as per page.

There are some free alternative also, however I don’t trust them. So, can’t recommend.