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?
- Set JPEG compression for specific custom image sizes
- Define custom Page Template without its own .php file
- deregister scripts on certain page
- syntax for remove_filter in parent theme with class
- Convert hyphen to underscore in permalinks
- Override parent theme function that is not hooked or in the functions.php file
- Remove bulk actions based on user role or capabilities
- Removing title from page
- Hide some items from Screen options in dashboard for products
- Adding body class when post contains a specific shortcode
- Replace Archive Widget Link Text
- 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
- Limit filter upgrader_post_install to a single plugin
- How to update feed only 2-3 times a week (for Feedburner email)?
- Remove function or filter
- wp_enqueue_script add integrity parameter
- Passing arguments to my function with do_action and add_action is not working
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- Register vendor JS/CSS only on pages that require them?
- Adding HTML to the end of every post with the Block Editor
- functions.php How to add css/js depending on Template Name?
- how to en-queue jQuery to load before the tag
- Replace a menu with widget or a custom template file programmatically
- Run wp_kses_decode_entities on atom feed?
- Filtering out the #more anchor link that gets produced by
- Can’t filter wp_get_attachment_link
- append to existing parent theme function
- jQuery does not work
- different style sheet for just one page template
- Override the WordPress core function wp_referer_field
- How to add custom JavaScript in functions?
- How to edit the Tags within the image file URLs?
- How to add_filter html template to middle of content
- add_action wp_enqueue_script priority level only works for admins
- Redefine function arguments before rendering
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Enqueue script on every page except one
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Combine embed_oembed_html and oembed_result
- Load JS file only in specific template
- login_headertitle is deprecated since version 5.2.0
- Filter to wp_list_authors
- The_content and Preg_replace in loaded Iframe [closed]
- 404 when enqueue_script using plugin_url
- Add Adsense code between job listings – wp job manager plugin
- Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
- video.js not enqueueing?
- Replace header image on all other pages but home – URL issue
- Page Template Won’t Load Correct CSS File
- Enqueueing a code block from an options framework
- Fatal error: allowed memory size when after using enqueue_script
- Any adverse effects of adding apply_filters to a function?
- How to use wp_enqueue_script properly?
- Get webpack to work on child theme
- how can I add filter in specfic field in my website?
- How to load a css file depending on the current role
- Customizing the wp_video_shortcode output with add_filter
- How to add HTML into error message
- Removing comment lines from all enqueued js files using a filter function
- Stylesheet does not load despite functions.php
- How to make the RTL.css the dominant css code?
- Unable to declare AOS library in functions
- function replace_text for entire page
- add product thumbnail to checkout page only and include variation name
- Graphic before title – Specific Category
- Which method is more correct for removing WooCommerce Extensions menu item?
- Hide disclaimer from summary excerpts
- Only seems to be displaying one child when there are supposed to be multiple
- Why might wptexturize have become re-enabled?
- WordPress Jquery+scripts enqueue issue
- functions.php filters not applied in AJAX call
- Settings in functions.php used by a plugin
- Allow tags and attributes in post and pages content
- Override parent theme function that is not hooked or in the functions.php file
- Can’t change excerpt length and more tag
- Using array page name together with page id to deregister script
- Remove snippets of JS from core
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- Loading newest dependency javascript module file in functions.php