Trying to get my head round functions.php and am wondering how often it is loaded?


Simple answer is once. As any other PHP file otherwise it would likely cause crash because of function redefinitions.

More complex answer is there can be actually two different functions.php loading - one for parent theme and one for child theme. Tricky part here is that child theme's loads before the parent's, which can at times be counter-intuitive for some purposes (like working with hooks).

  • Thanks! So if I'm not using child themes, it only gets called once per session, install of theme, admin page view? Not quite clear.
    – jnthnclrk
    Oct 21 '10 at 15:19
  • Once per WordPress engine load. It is included in wp-settings.php, which is early in loading process and is not conditional.
    – Rarst
    Oct 21 '10 at 15:23
  • And what triggers the WordPress engine load event? For example, do I need to uninstall and reinstall a theme to trigger functions.php to be re-loaded?
    – jnthnclrk
    Oct 21 '10 at 19:43
  • No, its loaded on every pageview, whether admin or front-end. Oct 21 '10 at 19:55
  • Ahah. I see now.
    – jnthnclrk
    Oct 21 '10 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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