You are very nearer to the solution, because you are on the right path. Just to tweak a little bit:
There are two such action hooks:
So the way you can do it, is: hook ’em differently:
//Dequeue Styles
function project_dequeue_unnecessary_styles() {
wp_dequeue_style( 'bootstrap-map' );
wp_deregister_style( 'bootstrap-map' );
}
add_action( 'wp_print_styles', 'project_dequeue_unnecessary_styles' );
//Dequeue JavaScripts
function project_dequeue_unnecessary_scripts() {
wp_dequeue_script( 'modernizr-js' );
wp_deregister_script( 'modernizr-js' );
wp_dequeue_script( 'project-js' );
wp_deregister_script( 'project-js' );
}
add_action( 'wp_print_scripts', 'project_dequeue_unnecessary_scripts' );
And the correct way is to deregister them beside dequeuing. So first dequeue them, and then deregister them accordingly.
Related Posts:
- Child Theme – what is the scope of overwriting files?
- wp_enqueue_script with dependencies doesn’t work
- Help with enqueing scripts in footer after init action
- How to cancel `wp_print_scripts`?
- Including style.css in Child Theme
- Including files in Child Themes
- Modular CSS and JS in Child Themes
- How to get, in WP page’s script, a wp enqueued script (in Functions.php)?
- When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?
- How do I dequeue a parent theme’s CSS file?
- Check if a script/style was enqueued/registered
- How do I get the $handle for all enqueued scripts?
- How can I get a list of all enqueued scripts and styles?
- Correct Method to run scripts with dependencies without enqueue?
- Cannot deregister a script using wp_deregister_script
- How to dequeue / deregister any theme styles and scripts
- Hyphens vs. periods in the script slug in wp_register_script?
- jquery script not enqueued in child theme
- How to load JQuery easing script in wordpress?
- wp_register_script multiple identifiers?
- enqueue and localize script in footer
- Adding Custom Javascript to Skeleton Child Theme
- How to Add a Custom Script to Customize.php
- wp_enqueue_script vs. wp_register_script
- Best way to enqueue extremely popular scripts like bootstrap and font awesome
- How to dequeue / deregister parent theme style
- How to remove some external js files from source?
- Best spot for wp_register_script() and wp_register_style()
- Select2 in WordPress
- Register script/style: Is it possible to customize the version query string via plugin?
- How to load script-related styles automatically?
- Modernizr check first, then move on to wp_register_script()/wp_enqueue_script
- How do I get a child theme to load scripts from the parent theme?
- WP .js script file not loading
- How do I enqueue a JavaScript in my footer via the functions.php file?
- getting a js file for one page
- wp_add_inline_script not adding when script_loader_tag filtered
- Retrieve URL of Script/Style and Dependencies
- Can’t see why my scripts aren’t loading when I register and enqueue them
- Why won’t my scripts load?
- WordPress script file version numbers changing in live environment
- How to create a child theme with multiple css files.
- Is there a way to list all the JavaScript scripts that are actually loaded by WordPress? Do we care?
- Change script type and src of plugins in theme
- How to enqueue JavaScript file that depends on CSS stylesheet
- Styles and scripts inside template part
- wp_dequeue_style and wp_dequeue_script not working on server but does work on local xampp
- Adding multiple wp_register_scripts for templates in WordPres?
- Localizing script to pass a value to a javascript function
- why quotes shown in WordPress?
- Enqueuing script is adding extra text for google maps [closed]
- get_stylesheet_directory() in child theme breaks parent scripts
- Deregister multiple scripts using a function?
- Enqueuing a script before anything else
- wp_enqueue_script was called incorrectly Issue when active plugins of WordPress Admin Bar Improved
- wp_enqueue_scripts does not work
- wp_enqueue_style referencing parent theme
- 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
- Javascript asset not enqueuing with the rest
- How to register script with null value for version?
- Using wp_enqueue_script on scripts that contain PHP
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- Stop a plugins js and css from loading on all pages and show up only where it is called
- How do I pass $in_foooter to wp_enqueue_script() without passing other params?
- Enqueue registered dependencies only when necessary
- How do I display the handle for all front-end enqueued scripts in plugin options page?
- css3-mediaqueries-js failing with child theme
- 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
- Scripts don’t enqueue after removing plugin
- Register and enqueue conditional (browser-specific) javascript files?
- Is it safe/recommended to use wp_enqueue_script function outside the functions.php file?
- wp_enqueue script my_javascript_file in the footer
- Why does this line of code make photo albums appear?
- Issue with using Underscore in WordPress
- Track down where script is being enqueued from
- $wp_styles->registered not giving ALL the styles?
- Most elegant way to enqueue scripts in function.php with foreach loop
- Enqueue scripts to a specific header-.php?
- Enqueue styles properly in a child theme and stylesheets location
- What are the advantages of using wp_enqueue_script()
- Deregistering a script in WordPress seems impossible
- Move scripts to footer, but exclude one script?
- wp_editor() youtube link does not load video
- Where is the right place to register/enqueue scripts & styles
- Where to insert Google Maps API code in functions.php
- Loading Scripts For Specific Template
- why wp_enqueue_scripts() not working?
- FullCalendar in WordPress is not working
- Wp_deregister_script() doesn’t work
- enqueue_scripts() in child theme doesn’t work
- How do you load js and style resources from CDN with local fallback using wp_enqueue_scripts?
- Set a parent script presence status true so that child scripts load in wordpress
- How to wp_enqueue_script with html?
- Bootstrap css not getting applied to the custom WordPress Dashboard Widget
- WooCommerce not enqueuing its scripts [closed]
- How to give path to files in plugins folder?