I am using a plugin which enqueues a javascript file in one of its shortcode functions (which I run on a page).
I don't want this file to be loaded.
So I tried using wp_dequeue_script
in my functions.php
file but this didn't work.
Perhaps my functions.php
file is loaded before the shortcode that's in the page? How can I get around this issue?
The shortcode function:
global $dwqa, $dwqa_sript_vars, $script_version; ob_start(); $dwqa->template->remove_all_filters( 'the_content' ); echo '<div class="dwqa-container" >'; dwqa_load_template( 'question', 'submit-form' ); echo '</div>'; $html = ob_get_contents(); $dwqa->template->restore_all_filters( 'the_content' ); ob_end_clean(); wp_enqueue_script( 'jquery-ui-autocomplete' ); wp_enqueue_script( 'dwqa-submit-question', DWQA_URI . 'templates/assets/js/dwqa-submit-question.js', array( 'jquery', 'jquery-ui-autocomplete' ), $script_version, true ); wp_localize_script( 'dwqa-submit-question', 'dwqa', $dwqa_sript_vars ); return $this->sanitize_output( $html );
How can I not load this particular js
file?
wp_enqueue_script
. I will update my question, but the function issubmit_question_form_shortcode
in this file: github.com/designwall/dw-question-answer/blob/master/inc/…