Do not load javascript when not needed

[ad_1]

Hey there,

We are running into a conflict with other plugins because of the Select2 library. I see that no matter what ProfilePress includes the JS on every page even though its not being used 99% of the time. Is there a way to get an option in the upcoming version to dequeue scripts on frontend when not in use?

You somewhat do that now, but only for your frontend.js file. You load

    wp_enqueue_script('ppress-flatpickr', PPRESS_ASSETS_URL . '/flatpickr/flatpickr.min.js', array('jquery'), PPRESS_VERSION_NUMBER);

    wp_enqueue_script('ppress-select2', PPRESS_ASSETS_URL . '/select2/select2.min.js', array('jquery'), PPRESS_VERSION_NUMBER);

no matter what

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer