wp_is_mobile dequeue not working

Question

According to this topic: Dequeue Scripts and Style for Mobile not working?

I used the last answer but for Slider revolution plugin and it does not work:

This is my function in functions.php:

add_action( 'wp_enqueue_scripts', 'remove_plugin_scripts', PHP_INT_MAX );

function remove_plugin_scripts() {
    if ( wp_is_mobile() ) {

    // Remove script file.
    wp_dequeue_script( 'rbtools.min.js' );
    wp_deregister_script( 'rbtools.min.js' );

    wp_dequeue_script( 'rs6.min.js' );
    wp_deregister_script( 'rs6.min.js' );
}
}

I just want to disable this two js files: rbtools.min.js and rs6.min.js from mobile loading for better rank in lighthouse.

this two js files loads from this file:
/wp-content/plugins/revslider/public/assets/revslider-front.class.php

0
Rasam Server 4 weeks 0 Answers 4 views 0

Leave an answer