When shortcodes are evaluated, the header of the site has already been assembled. So if the shortcode wants to enqueue a script it must do so in the footer (by setting the last parameter to wp_enqueue_script to true.
At this point you’re still not too late to prevent the file from actually being included in the footer. Normally, in functions.php you would enqueue or (de)register scripts with the after_setup_theme hook. However, if you look at the order in which actions are executed you would be trying to deregister a script long before it is enqueued.
So, you would have to find a hook that fires after the shortcode has enqueued the script. The logical choice would be wp_footer, like this:
add_action ('wp_footer','wpse240803_deregister_dwqa');
function wpse240803_deregister_dwqa() {
wp_deregister_script ('dwqa-submit-question');
}
Related Posts:
- How to include code only on specific pages?
- force enqueue script to be first in order of prominence
- When can you get current page ID and initialize hooks right after?
- enqueue script only if it is not already enqueue
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Pass $this to function nested in another public function of the same class
- Dequeue / Deregister script and replace it with a new plugin
- Add extra parameter in tag using script_loader_tag
- How to avoid redefining requirejs in plugin when another plugin also uses requirejs
- Problem in loading javascript in footer
- React JSX in WordPress Plugin Development
- Is there an earlier hook than login_head or login_enqueue_scripts?
- Can someone please tell me what is wrong with my plugin?
- Enqueue WordPress plugin scripts below all other JS
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Best place for short bio,image and button [closed]
- accessing wp.media api from a tinymce plugin
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- Is there a loading priority for login_enqueue_scripts?
- Why am I unable to load scripts in head in plugin?
- Remove / overwrite some functions in buddypress.js
- How do I add some javascript validation to the admin interface form’s onsubmit?
- Flipping Book PHP Code? Any experience?
- Add type to enqueued script inside plugin
- Executing Javascript in Plugin
- Load CSS files in header of Bones theme?
- How to enqueue some javascript source once per page
- WordPress load same script two times
- Why does my custom plugin only function correctly once per page?
- JS working when used normally but not in wordpress
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- Why can I not deregister my style and script on custom post type?
- WordPress shortcode plugin not working
- Beginner question: Accessing js script in plugin
- correct way to enqueue js and css files for wordpress shortcode?
- WordPress Gutenberg Custom Block the viewScript does not get loaded on the frontend when my block is inserted
- get specific value of a array | PHP
- How do I add $_SESSION[”] to my wordpress page?
- How to get specific string/value from an array? php [closed]
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Shortcode Attributes to Return different $_POST
- How use wp media upload liberary in react components?
- How to change shortcode’s default theme?
- Override/ignore CSS from active theme as not to interfere with my custom CSS
- Is there a way to convert shortcodes to html content?
- WooCommerce: after install hook
- Access post title from custom meta box on title change
- How to use filter to disable adding a product to wishlist?
- Save user total active time after login in wordpress [closed]
- WordPress: Add custom add_filter for custom functions
- Shortcode not working – quotes seems strange
- Background Music WP [closed]
- Get all the URLs of the pages that uses a specific shortcode
- How to remove a class function from a plugin by using remove_action()?
- Custom plugin – load enqueue only for this plugin
- Advanced WordPress plugin activation detection
- How to use template inside plugin shortcode with variables for big HTML code
- Get param from shortcode in plugin function
- shortcode – multiple instances of same parameter name in one shortcode instance
- profile_update hook doesn’t works inside a class
- Function call in wordpress short code handler fails
- strange shortcode error: does shortcodes requires any dependency?
- Loop returns the current page’s permalink and guid instead of the post in the loop
- wp_loaded with static Singleton
- How to use custom Javascript code inside a plugin?
- wp_trash_post hook – problem with page updating if using wp_die
- Why does my jQuery plugin show up as text in WordPress?
- Adding a simple Javascript file with a plugin
- JQuery needs to be defined in , but Gravity Forms is defining it in the
- How to return the values from a row where a value occurs for the first time among the rows available?
- Inserting shortcode in href – any ideas or workarounds?
- Function added to hook “new_to_publish” not executing – custom plugin
- Get Image Having the ID [closed]
- is it possible to hook every page style?
- wp_localize_script not passing the data
- Add the_post_thumbnail_url to a shortcode in function.php
- Comment Approve – Add custom function when comment is approved
- Disable submit button order
- Plugin: Hooking up classes that have their own hooks
- Enqueue script: link not working in page source
- Add action to custom Function
- Get post content from outside the loop with plugin shortcode usability
- Hook for altering the content of all wp mails
- How to rewrite URL and get the values?
- Deregister scripts from plugin
- Conditional custom redirect
- Is there a good way to load tiny_mce_popup.js through editor.windowManager.open?
- How to prevent tabs from opening all at once
- Form Plugin for Api Requests which is used via Shortcode
- Custom CSS not being added by plugin
- Hook on creating a menu entry?
- Echo out element to another page.
- Social share buttons text shows up on post excerpts
- Meta slider plugin only works after first refresh – Object has no method ‘flex slider’
- Shortcode and variable
- What hook can I use to modify custom post data before it is displayed on the page?
- How to hook into action/filter call