• Hi,
    Thank you for your plugin.
    We are now at optimizing our site, and part of the process is dequeuing all styles and scripts files and bulk them together for better speed and less http requests. We are not able to dequeue the Simple Membership plugin assets. When using wordpress’ dequeue_styles() and dequeue_scripts() functions, it doesn’t affect them. Is there any other way to do remove them, or at least relocating them on the footer?
    Thanks in advance for your advice

    https://wordpress.org/plugins/simple-membership/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, what process are you currently implementing to dequeue the css and js files? Do you have a cache plugin installed?

    Thread Starter Kermit524

    (@kermit524)

    Hi thanks for your replay,
    I am using wp_dequeue_script and wp_dequeue_style functions to remove the 2 css files and the 2 javascript files.
    In the source code, the files are referred like this:

    <link rel='stylesheet' id='swpm.common-css'  href='http://carrier/thewines/wp-content/plugins/simple-membership/css/swpm.common.css?ver=4.5.2' type='text/css' media='all' />
    <link rel='stylesheet' id='validationEngine.jquery-css'  href='http://carrier/thewines/wp-content/plugins/simple-membership/css/validationEngine.jquery.css?ver=4.5.2' type='text/css' media='all' />
    <script type='text/javascript' src='http://carrier/thewines/wp-content/plugins/simple-membership/js/jquery.validationEngine-en.js?ver=4.5.2'></script>
    <script type='text/javascript' src='http://carrier/thewines/wp-content/plugins/simple-membership/js/jquery.validationEngine.js?ver=4.5.2'></script>

    Here’s what’s in my functions.php file:

    function remove_vendor_scripts () {
    wp_deregister_style( 'dashicons' );
    
    wp_dequeue_script( 'swpm.common-css' );
    wp_dequeue_script('validationEngine.jquery-css');
    }
    
    add_action('wp_enqueue_scripts', 'remove_vendor_scripts');

    1. The css files have handlers: swpm.common-css and validationEngine.jquery-css, so I am passing them as arguments for the wp_dequeue_styles() function, but this doesn’t affect the page.
    2. The javascript files don’t have handlers, so I am not sure which is the best way to refer to them for the wp_dequeue_scripts function.

    Currently I don’t have any cache plugin installed.

    Thanks again.
    Michal

    Plugin Support mbrsolution

    (@mbrsolution)

    Thank you Michal for sharing the code and information. This will help the plugin developers to assess your issue further.

    Regards

    Plugin Author wp.insider

    (@wpinsider-1)

    All of our front-end JS and CSS files are loaded using the following hook:

    wp_enqueue_scripts

    So you should be able to dequeue them. It is likely that your custom call is happening at a wrong time of the site’s page load execution (meaning it is being ineffective at intercepting it).

    You can inspect the following function of our plugin’s code to see how we are using enqueue to load those files.

    File: classes/class.simple-wp-membership
    Function: common_library()

    That function is executed using the WordPress’s wp_enqueue_scripts hook.

    Thread Starter Kermit524

    (@kermit524)

    Thanks wp.insider! Yes, I just now managed to dequeue the js files so I can add them directly in my build. However for some reason the css files are not dequeued. I probably miss something. Here’s the piece of code out of the function.php file:

    function remove_membershop_calls() {
    	/* Remove Simple membership js and css */
    	wp_dequeue_script( 'jquery.validationEngine-en' );
    	wp_dequeue_script('jquery.validationEngine');
    	wp_dequeue_style( 'swpm.common-css' );
    	wp_dequeue_style('validationEngine.jquery-css');
    }
    add_action( 'wp_enqueue_scripts', 'remove_membershop_calls', 20 );

    Any idea what am I doing wrong?
    Thanks again, and in advance.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Removing plugin css and js’ is closed to new replies.