We are creating an internal network of sites using MU and there are some small things we would like to have globally on all the sites without having to add them individually for each site. I would like to add a block of JavaScript and CSS that will execute on every site. What’s the best way of going about this?

2 Answers
2

Your answer, Kyle, is the mu_plugins folder. Create it within wp-content. Any php file put in here will be automatically loaded into ALL multisite blogs (or any non-multisite blogs).

This is a great area to put plugins vital to the site working, or shared functionality such as custom post types, taxonomies, filters, etc. Really anything! The main bonus here is when updated said “shared” files, you don’t have to do it in every single theme that utilizes it! It’ll be available for all themes, on all sites.

If you want to sort your stuff within mu_plugins just put everything in a nice folder structure, and create a index.php or load.php in the root of mu_plugins where you can load everything in.

From there, wp_enqueue_script just as you normally would!

Leave a Reply

Your email address will not be published. Required fields are marked *