Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I work in a multisite environment where all of the sites are related. A lot of recent developments have required me to copy and paste certain functions into many different theme folders, which causes problems if I need to update them everywhere.

What would be the best way to have a global "functions.php" file? My thoughts are either to include a file in the themes folder and include it, or create a plugin and network enable the plugin.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

What you are looking for is a "MU-Plugin"-- "Must-Use Plugin".. Originally these were called "Multi-User Plugins" and were intended for exactly your purpose-- to provide a way for site admins to enable functionality on all sites of an installation.

Create a directory at /wp-content/mu-plugins/ and put your PHP file(s) in it. WordPress will load the files automatically. MU-PLugins are "are automatically enabled on all sites in the installation" and cannot be deactivated except by physically removing the file.

Be sure to read the "Caveats" part of the Codex page.

share|improve this answer
    
this is perfect. thank you –  Jacob Raccuia Mar 7 at 14:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.