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]
- Does WordPress maintain revisions for index.html template?
- what use have double styles in index.html?
- Add Media + Quick Edit buttons not working
- Theme comment callback results nothing
- how to register a second page-template
- How to fetch the no. of Users dynamically?
- Does not work bookmarklet in the theme Tagology
- How do I block a subdirectory from WordPress theming?
- spacing disappears on posts when importing
- How to remove the option data of a theme when that theme is removed?
- Problems Replacing Background Color with Static Background Image in Responsive Design
- How to prevent tinyMCE editor to be loaded completely in Text Editor?
- Lost in creating multiple meta boxes
- Showing wordpress theme demo at front end
- div having different appearances in different themes
- Categorising themes by folders in backend
- How to show tags in posts with a theme that does not do it
- Diagnosing a connection reset problem
- Create /archive page in WordPress Theme
- WordPress Theme Problem
- Create a live demo gallery for themes
- separate home page into separate pages
- Resetting Themes Folder to Default
- My site looks different when activating new theme
- Moving WordPress with Super Skeleton theme
- Entire VPS locks up when using particular theme [closed]
- Satoshi WordPress Theme – Portfolio SetUp Issues
- Using a page (Blog template) for home page blog posts is problematic?
- How can I print out a single stylesheet or javascript link?
- Customising a theme
- Blog shows up without Theme/CSS styles
- Converting HTML5 to XHTML
- Boldy theme – Regarding the images above the boxes
- Theme Options Menu Item – Permission Issue
- Symbolic Links for themes – linking one theme to many wordpress installs
- Capcha not getting displayed
- Fatal error: Call to undefined function get_header() and BuddyPress [closed]
- No “available widgets” (wordpress 3.2.1 multisite)