• Resolved adenmantmea

    (@adenmantmea)


    Working on the optimization of our site, I’m seeing the following in the head section for non-logged-in visits:

    * file /wp-content/plugins/wicked-folders/css/admin.css?ver=2.17.2
    * file /wp-content/plugins/wicked-folders/js/admin.js?ver=2.17.2
    * file /wp-content/plugins/wicked-folders/js/app.js?ver=2.17.2
    * code block setting two vars: wickedFoldersL10n and wickedFoldersSettings

    Are these needed for guest (not logged in) visits to the website? If not, is there a way to stop them from loading?

    • This topic was modified 4 years, 4 months ago by adenmantmea. Reason: update title
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author wickedplugins

    (@wickedplugins)

    Hi @adenmantmea,

    Generally, those files shouldn’t be needed for guest visitors. You can stop them from loading by using the wp_dequeue_script and wp_dequeue_style functions.

    Here are the handles for the files:

    /wp-content/plugins/wicked-folders/css/admin.css: wicked-folders-admin
    /wp-content/plugins/wicked-folders/js/admin.js: wicked-folders-admin
    /wp-content/plugins/wicked-folders/js/app.js: wicked-folders-app

    Dequeuing the ‘wicked-folders-app’ script should also remove the associated inline code block.

    I hope this helps. If you have questions, please let me know.

    Thread Starter adenmantmea

    (@adenmantmea)

    Thank you, it seems to be working. My only request would be: is there a way this could be built in to the plugin so everyone could benefit?

    For those looking at this in the future, here is the code to remove the script and style files for guest visitors, added in my theme’s functions.php file. The number at the end is to force it towards the end of the stack to make sure it has been added before we try to remove it.

    /* Remove wicked folders scripts if not logged in */
    function wf_dequeue_files(){
        if(!is_user_logged_in()){
            wp_dequeue_script('wicked-folders-admin');
            wp_dequeue_script('wicked-folders-app');
            wp_dequeue_style('wicked-folders-admin');
        }
    }
    add_action( 'wp_enqueue_scripts', 'wf_dequeue_files', 2000 );
    Plugin Author wickedplugins

    (@wickedplugins)

    Hey @adenmantmea,

    Thanks for sharing the code snippet that you used.

    I like your idea of building it in and we’ll look into that (perhaps adding it as an option).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CSS/JS loading when logged out’ is closed to new replies.