You need to remove the actions before they are called. In order to ensure this is the case call your function at init, like so:
add_action('init', 'strip_the_junk');
In general, its not a great idea to use the wp_enqueue_scripts
hook for anything besides wp_enqueue_script
or wp_enqueue_style
functions.
Related Posts:
- How to load scripts/styles specific for a page
- Dequeue Scripts and Style for Mobile not working?
- Enqueue script o style only if a template part is loaded
- If is multiple page templates
- Enqueue scripts not working with if is page conditional tag in functions.php
- enqueue styles for only mobile wp
- Scripts not loading when using the wp_enqueue_scripts action
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- Theme JS is available but theme CSS isn’t
- Advanced method to control cache of enqueued style/script
- Add custom css file after plugin css with WordPress Child Theme functions.php
- wp enqueue style on about us page
- Test CDN link from function.php or wp_enqueue_script/style?
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- I need to ‘wp_dequeue_script’ and ‘styles’ and ADD a bunch of other css and js
- Why is style.css not loading through the functions.php
- custom post with loading script per single post
- Print all inline styles to head
- using enqueue_script in a shortcode isn’t working
- remove empty paragraphs from the_content?
- Issues with title-tag and document_title_parts
- Remove Actions/Filters added via Anonymous Functions
- WordPress Enqueue for homepage only, functions.php, wp-framework
- Set JPEG compression for specific custom image sizes
- Define custom Page Template without its own .php file
- Add class to menu items of one specific menu (nav_menu_css_class)
- How to influence the information displayed on widget inside wp-admin
- Removing default image size list in Media Box
- deregister scripts on certain page
- How to restrict actions and filters “properly” by conditions
- Filter the query ONLY for the search results page
- Enqueue Script with data attributes
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Using add_filter() in Widgets
- Customize WordPress Media Manager – Media Window
- How to enqueue every script in a folder automatically?
- How to reduce original image quality on upload?
- Is it possible to use a forgot password url filter?
- syntax for remove_filter in parent theme with class
- Add body class of category parent
- TinyMCE custom stylesheets for different post types
- Wrap gutenberg block ‘div’ in other elements/extra HTML
- is_front_page not working in functions.php
- Convert hyphen to underscore in permalinks
- Override parent theme function that is not hooked or in the functions.php file
- Remove Page Title from Static Frontpage
- Programmatically Add Font-Awesome Icons to Category Widget
- Most elegant way to enqueue scripts in function.php with foreach loop
- wp_register_script not loading as expected
- Remove bulk actions based on user role or capabilities
- Default or Preset Content for Custom Post Types
- Problem using is_single() to enqueue script from functions.php
- Enqueue less file not working in child theme?
- Override a class function to include a custom template
- How to override filter in child theme?
- I created a child theme and it doesn’t work for some of the css files
- Removing title from page
- Hide some items from Screen options in dashboard for products
- How to change a certain text or term of WordPress into a custom into the whole site?
- Enqueuing External Javascript functions.php
- Child Theme Not Overriding Parent Theme
- How to enqueue JavaScript for specific WordPress pages only?
- Adding body class when post contains a specific shortcode
- Enqueue styles after a plugin
- How to override enqueued styles using a child theme
- Enqueuing Script in functions.php vs on the page
- Replace Archive Widget Link Text
- Dequeue script in template isn’t working
- Exclude Empty Child Categories in Menu
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Best way to programatically add “rel” attributes to page and post images
- add_filter priority problem
- Limit filter upgrader_post_install to a single plugin
- How to update feed only 2-3 times a week (for Feedburner email)?
- Manipulate Output of wp_list_something: select menu instead of li’s
- Clean-up script tags
- How to use IF Statement in WordPress?
- Gravity Forms field entries into wp_query loop [closed]
- Post Pagination Showing Same Posts Every Page
- Show excerpt for only first post in query
- Remove function or filter
- modify a function filter
- Super simple shortcode not working
- How would go about if I just want a temporary function?
- Generating rel=prev and rel=next only on wordpress categories
- How do I get a child theme to load scripts from the parent theme?
- How to make applyFilters function return false via functions.php
- wp_enqueue_script add integrity parameter
- Passing arguments to my function with do_action and add_action is not working
- How to filter out shortcode when displaying the_excerpt() in the loop?
- Accepted arguments value in hook functions
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- Get current page_id before loop, in functions.php
- Load JS Script only for custom post types
- Register and enqueue style.css custom theme
- Which action hook to use for function?
- Adding multiple taxonomy filters to functions.php
- str_replace function in theme
- wp_is_mobile dequeue not working
- Can’t check if a post has thumbnail adding filter to get_post_metadata()