1

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

1 Answer 1

2

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).

5
  • 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
    Commented Oct 21, 2010 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
    Commented Oct 21, 2010 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
    Commented Oct 21, 2010 at 19:43
  • No, its loaded on every pageview, whether admin or front-end. Commented Oct 21, 2010 at 19:55
  • Ahah. I see now.
    – jnthnclrk
    Commented Oct 21, 2010 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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