Is there any global functions.php file which works for any theme?

Posted by Prem Tiwari | Updated on

The difference between theme and non-theme code is organisational rather than technical. Any code that is active contributes to resulting environment, does not matter where it is loaded from.

There is number of places where code gets loaded from, which are not part of WordPress core:

  • wp-config.php configuration file
  • active theme (and its parent in for child themes)
  • active plugins
  • must use plugins
  • drop-ins (these are somewhat advanced and serve very specific purposes)

Typical place for your own code, that should not be part of theme, is to create a plugin. Other approaches do not have benefits from generic case, but forfeit interface (managing through admin area) and technical (activation/deactivation/uninstall events) conveniences of normal plugin.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers