When attempting to dequeue a script, we need to hook in after the script is enqueued, but before it’s printed. In this case, the Disqus plugin is using the wp_footer
hook at a priority of 10 to enqueue the scripts. The footer scripts get printed during wp_footer
at a priority of 20. So we should be able to hook into wp_footer
at a priority of 11 and dequeue the script.
add_action( 'wp_footer', 'wpse_262301_wp_footer', 11 );
function wpse_262301_wp_footer() {
wp_dequeue_script( 'dsq_count_script' );
}
Related Posts:
- When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?
- Check if a script/style was enqueued/registered
- How to properly dequeue scripts and styles in child theme?
- How to dequeue / deregister any theme styles and scripts
- Hyphens vs. periods in the script slug in wp_register_script?
- enqueue and localize script in footer
- How to Add a Custom Script to Customize.php
- wp_enqueue_script vs. wp_register_script
- Child Theme – what is the scope of overwriting files?
- Best way to enqueue extremely popular scripts like bootstrap and font awesome
- Best spot for wp_register_script() and wp_register_style()
- wp_enqueue_script with dependencies doesn’t work
- Register script/style: Is it possible to customize the version query string via plugin?
- Help with enqueing scripts in footer after init action
- Modernizr check first, then move on to wp_register_script()/wp_enqueue_script
- How to cancel `wp_print_scripts`?
- Including style.css in Child Theme
- getting a js file for one page
- Can’t see why my scripts aren’t loading when I register and enqueue them
- Including files in Child Themes
- WordPress script file version numbers changing in live environment
- Change script type and src of plugins in theme
- How to enqueue JavaScript file that depends on CSS stylesheet
- Adding multiple wp_register_scripts for templates in WordPres?
- Localizing script to pass a value to a javascript function
- Enqueuing script is adding extra text for google maps [closed]
- Deregister multiple scripts using a function?
- wp_enqueue_scripts does not work
- Modular CSS and JS in Child Themes
- If a Script has been enqueued but not registered can I still removed it?
- include jquery plugin file not working
- How to use wp_register_script / wp_enqueue_script for multiple queries
- How to register script with null value for version?
- Using wp_enqueue_script on scripts that contain PHP
- Stop a plugins js and css from loading on all pages and show up only where it is called
- Enqueue registered dependencies only when necessary
- How to get, in WP page’s script, a wp enqueued script (in Functions.php)?
- wp_enqueue doesn’t load dependencies
- Why do WordPress adds the id=”handle-{js|css}” attribute to scripts and stylesheet?
- Dequeue/deregister scripts for everybody but the administrator
- How can I get a list of all enqueued scripts and styles?
- Load CSS/Javascript in frontend conditionally if block is used
- How can I de-register ALL styles all at once? And same with Javascript?
- Removing specific style from wp_head
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- Enqueue script only for IE
- Problem in wp_localize_script
- Adding dependencies to script enqueing
- Why is it wrong to use admin_print_scripts-{hook} to enqueue a script (.js) file?
- Enqueueing Scripts on a Custom Top-level Menu Page
- Enqueue script with url_query variables?
- Can’t get JS code to work with shortcode
- Performance-wise, is it better to enqueue a (small) script on every page or test to see if it’s needed?
- Bootstrap js refuses to load
- Stop WordPress editor embedding links
- Enque Typekit Fonts – Not Found
- Why isn’t jQuery 2.1 loading in the header?
- Notice: wp_enqueue_script was called incorrectly
- Do we have to register JQuery if we want to use it in wp_enqueue_script()?
- Retrieve URL of Script/Style and Dependencies
- using conditionals on enqueue styles
- debugging js scripts
- Can’t load JS File
- React JSX in WordPress Plugin Development
- How to enqueu php files with custom variable & conditionals?
- Not sure if enqueuing js scripts properly
- Unable to dequeue a plugin script. I think I’ve tried everything
- Action hooked on wp_enqueue_scripts running twice
- How to enqueue the script without hardcoded in the theme files?
- Why is .map being added to the end of my file path?
- How can I properly enqueue tags in WordPress to use with Web Components?
- get_stylesheet_directory() in child theme breaks parent scripts
- wp_enqueue_scripts are apearing inline rather than as links
- How to remove all enqueued assets from the active theme?
- Not all my scripts are enqueueing
- browser showing connection was reset while accessing posts from local host
- Should we explicitely enqueue jQuery and our theme’s main stylesheet?
- wp_enqueue_style referencing parent theme
- Enqueueing Scripts/Styles mid-page
- add WordPress script to page conditionally by category
- I want to set global directory locations for my CSS and JS locations. How?
- Fatal error: Call to undefined function wp_enqueue_media()
- javascript file is not enqueing
- Calling wp_localize_script in a different function
- thickbox never gets called (weird behavior)
- Modifying an enqueued script URL
- When to use wp_register_script() function?
- wp_enqueue_scripts action from a plugin overrides theme wp_enqueue_scripts no matter what the priority setting
- Trouble with wp_enqueue_script
- Can’t get jquery script to work
- Proper use of wp_localize_script?
- Prevent caching when using wp_enqueue_script?
- Should I be enqueueing styles/scripts once and then dequeueing them?
- Generating embed code for users to share
- How do I display the handle for all front-end enqueued scripts in plugin options page?
- css3-mediaqueries-js failing with child theme
- Enqueueing Script to footer puts it at the very bottom
- Trying to use wp_register_script/style and enqueu them from an array – getting an error [duplicate]
- wp_script_is(‘enqueued’) true, but file not requested in HTML
- How to give path to files in plugins folder?