Scripts Manager
Md FreeAdd Custom Code Where You Need It, and Only There
Scripts Manager adds custom code to the head and the end of the body, sitewide or on specific posts, archives and terms. It can also add body classes, and turn off plugin scripts and styles on pages that don’t need them.
Requirements
Details
Some code belongs on every page. Some belongs on one post. Scripts Manager lets you decide, without editing a template.
Page-specific scripts are added after the sitewide ones, so each page gets the sitewide code first and its own code after.
Start here
Header and Footer Scripts, Sitewide or Per Page
Print code in the head or just before the closing body tag, on every page or only where you need it.

Add scripts sitewide, on single posts and pages, on post type archives and the blog page, or on category and taxonomy archives. The same three fields appear in each place: Body classes, Header Scripts and Footer Scripts.
- Header scripts, printed in
<head> - Footer scripts, printed before
</body> - Sitewide, per post or page, per archive, and per term
Turn Off Plugin Scripts Where They Aren’t Needed
Scripts Optimization turns off selected plugin scripts and styles on pages that don’t use them.
Choose which plugin scripts and styles to turn off on single posts and on category and taxonomy archives. The list of plugins comes from the md_filter_dequeue_scripts filter, and the option only appears when something has been registered.
- A checkbox for each registered plugin
- On single posts, and on category and taxonomy archives
- Register a plugin with a label and its script and style handles
More Features
Small things that save you a template edit.
Body classes, sitewide or per page
Add custom body classes to every page, or to individual posts, pages and terms.

Google Analytics, if you’ve set it up
Scripts Manager prints the Google Analytics (gtag.js) tag when a Google Analytics ID is set in MD’s integration settings.
Register your own plugin
Developers can add a plugin to the Scripts Optimization list by returning an item from md_filter_dequeue_scripts, with a label and, optionally, scripts and styles, which are arrays of registered handles.
All Features
Everything Scripts Manager adds, big and small.
Header scripts
Printed in <head>.
Footer scripts
Printed before </body>.
Sitewide scripts
Added to every page.
Single posts and pages
Scripts for one post or page, in its Page Settings box.
Post type archives
Scripts for an archive page, and the blog page for posts.
Category and taxonomy archives
Scripts for a term, on its term screen.
Body classes
Added sitewide, or on individual posts, pages and terms.
Scripts Optimization
Turn off selected plugin scripts and styles on single posts and on category and taxonomy archives.
Google Analytics tag
Printed when an ID is set in MD’s integration settings.
Developer filter
md_filter_dequeue_scripts registers plugins for Scripts Optimization.
Frequently Asked Questions
Where do I add scripts?
Sitewide in MD settings → Scripts, for a post type’s archive in its settings, and per page in the Page Settings box on posts and pages, or on category and taxonomy term screens.
Do page scripts replace the sitewide ones?
No. Page-specific scripts are added after the sitewide ones.
Why don’t I see Scripts Optimization?
It only shows when a plugin has been registered with the md_filter_dequeue_scripts filter. Return an array keyed by an ID, where each item holds a label, and optionally scripts and styles.
Can I add body classes without code?
Yes. Add them in the Body classes field, sitewide or on an individual post, page or term.
What do I need to run it?
MD 6.0 or later, WordPress 6.2 or later, and PHP 7.4 or later.

