• Resolved samtulana

    (@samtulana)


    Hello. Explain why it is impossible to make the scripts of the plugin not loaded on pages where it is not needed? After all, this creates additional load on the server.

    Why can not these scripts be removed from pages where it is not used?

    wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/js/codedropz-uploader-min.js?ver=1.3.0
    wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/js/dnd-upload-cf7.js?ver=1.3.0

    Thank you.

    • This topic was modified 6 years, 8 months ago by samtulana.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    Hello @samtulana ,

    Thanks for asking, currently I’m using standard hooks from contact form 7 to load the scripts.

    This concern is related to contact form 7 plugin.

    If you don’t want to load the scripts on the page that don’t have contact form. (see below)

    https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/

    Read through “Step 2: Load the files on pages which contain contact forms” section.

    Thanks.

    Thread Starter samtulana

    (@samtulana)

    Thank you.

    I am familiar with this instruction, but the Contact Form 7 I have is on many pages, and not on one. After all, it’s possible in the plugin to realize the ability not to load scripts on those pages where I am not used or I need to climb into the file and make changes every time after updating the theme or create several dozen files for each form. It is very uncomfortable.

    Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    Hello @samtulana ,

    Currently there’s no option but is to create a separate template for each form or if you are familiar with the hooks you can dequeque specific scripts.

    Can you try the code below?

    function contact_dequeue_script() {
    	if( ! is_page('contact') || ! is_page('another-page-form') )
    		wp_dequeue_script('codedropz-uploader');
    		wp_dequeue_script('dnd-upload-cf7');
    	}
    }
    add_action( 'wp_print_scripts', 'contact_dequeue_script', 100 );
    
    Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    I haven’t heard back from you, closing this thread now.

    Thread Starter samtulana

    (@samtulana)

    Thank you very much, anyway, the script loads where it is not used. One } bracket in the code. Please close the topic

    • This reply was modified 6 years, 7 months ago by samtulana.
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Scripts are loaded’ is closed to new replies.