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.

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

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
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. –  goldenapples Oct 21 '10 at 19:55
    
Ahah. I see now. –  jnthnclrk Oct 21 '10 at 20:26

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.