I haven’t tried it, but this might do it:
global $wp_scripts;
if (is_a($wp_scripts, 'WP_Scripts')) {
$wp_scripts->queue = array();
}
Basically just resetting the scripts queue to blank. Should work, I think. You’d want this right at the top of your attachment template, probably.
From an optimization perspective, it would be faster to use the is_attachment() method to not enqueue the ones you want at all instead.
Related Posts:
- My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!
- Changing URL of scripts, scripts outside theme folder?
- Opinions and recommendations on the best barebones base theme [closed]
- Dynamic template serving, change theme_root using add_filter from current theme
- How to override the “inc” folder (or any folder) in a theme using child theme?
- Is it possible to access Gutenbergs reusable blocks in CPT block templates?
- Loading template files from a subfolder in my theme?
- WordPress as Backend, Laravel Front End: How to connect Routes?
- Can I obtain differents links for different installed theme?
- WordPress ignoring specified template for front page. Why?
- Can I apply a WP theme to a specific custom page template?
- WordPress Fatal error: Call to undefined get_header() in index.php on line 15 [closed]
- Change Theme from Plugin based on query_vars
- How to add template to theme in WP
- Added a new template file to a theme – get Call to undefined function error
- Question about the way that wp_register_script works
- How to find a file in WordPress themes [closed]
- Display a specific dynamic sidebar widgets on a specific page
- Child theme Page Template not loading
- Add js into a theme [closed]
- Creating new templates in child themes breaks layout
- Get WordPress to use another custom “author.php” file (“custom-author-file.php”)
- Search form not finding content in template page
- display comment form for specific post id
- Selected template is not respected for home page in WordPress
- Putting two themes together to create a complete site
- Is there a way to upgrade a theme without losing custom templates?
- Need help with making a website where user can add products
- Advantages of wordpress theme vs wordpress as a backend only [closed]
- Enqueue custom css file on specific page
- Is it good practice moving the main stylesheets after the plugin styles?
- Using the same database on another Subdomain
- Trying to fix a website that was built with WordPress and then taken off of it
- WordPress 5.1 upgrade has lost the parent theme JavaScript
- Understanding wp_enqueue_style
- Conditional config WP_HOME/WP_SITEURL does not update bloginfo(‘template_url’)?
- enqueue_script doesn’t work with HTML5 blank theme
- Create Custom Attachment Template That is Processed from Plugin Folder?
- Multiple sub directories for theme template pages
- How to remove the tripadvisor logo from the wordpress theme?
- Please help me clear my confusions about WordPress
- WordPress 2022 template, how to see the blocks added in post template on post edit?
- Can I use non-wordpress themes in WordPress?
- WordPress keeps switching back to empty template
- Removing a widget via theme editor
- Enqueue All Stylesheets Found In a Theme Folder
- How do I bring a page template into a new theme with separate styling?
- 12 column grid layout
- Theme Dev | Convert Template to Theme
- Revamping a WordPress mirror site – and I don’t know where to start!
- What is the template file for topic layouts in bbPress?
- Will this js code work in a page template?
- How to find out which template the HTML content comes from?
- Create a child Theme or custom Theme
- How to modify/ customise NextGen Gallery’s templates? [closed]
- wordpress template page Usage [duplicate]
- Overwrite template-tags.php in child theme
- What happens to bespoke page template references on theme change?
- How to add sidebar to homepage programmatically?
- Get header/footer list for a theme
- Homepage not loading correctly, only after refreshing
- How to clone a theme template from within WordPress? [closed]
- Link to specific Customizer section
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- How do you change the theme location?
- How can I check for malware in a Theme? [closed]
- Want to have the Post editor remembering the last editing position
- Theme of codinghorror.com
- Help with enqueing scripts in footer after init action
- Download WordPress.com theme: how?
- Create a dashboard-style site (not WordPress dashboard) – is there a theme? [closed]
- Help with WordPress Query
- Are theme .php files stored in the database?
- Execute filter in theme as last
- Why style.css with ?ver=3.9.2 not updating as the one without ?ver=3.9.2?
- An unexpected error occurred. Something may be wrong with WordPress.org
- Website redesign – New theme – Help needed
- ‘Add New’ button not present [closed]
- How can we hide the parent’s theme url at the child themes details on a multisite?
- Tips for managing code when developing a parent theme framework
- How can I show full text, not summary for the homepage and in categories?
- Variant of the same theme for each page
- How can I remove all traces of a theme?
- A thin line between native wordpress bahaviour and 3rd party themes
- Menu items do not “open” when mouse hover over them?
- wp_enqueue_script JS code runs too late (after user begins interacting)
- How to push a theme update for a ciustom theme used on multiple independant self hosted sites?
- theme customizations gone after enabling ssl
- Can’t embed certain youtube videos into theme
- How to customize a section of a widget only on certain pages or page
- How do I get the featured image to sit below the header in the twenty nineteen theme?
- Basic wordpress search shows no results
- How do I remove search bar that isn’t a widget?
- WordPress Customazation API section in section
- Resetting Themes Folder to Default
- How to Hide Blog Post Author?
- register_nav_menus syntax error, unexpected identifier “register_nav_menus” in
- Meaning of “if ( is_home() && ! is_front_page() )” snippet?
- RTL in posts only [closed]
- Blocking Google Fonts in wordpress website