[wp-hackers] Child theme functions.php & processing order

Otto otto at ottodestruct.com
Fri Dec 11 14:02:21 UTC 2009


On Thu, Dec 10, 2009 at 8:36 PM, Demetris <kikizas at gmail.com> wrote:
> The child’s functions.php is executed first.
>
> I would expect it to be the other way around.  (But I have no idea if
> it matters. For example, when both parent and child register one
> function or filter each to the same hook, the order can be adapted
> with the priority argument. But probably there are scenarios that I’m
> missing.)

The child is executed first, to allow the child to override the
parent. Think "pluggable".

Consider this case:

Parent functions.php

if (!function_exists('some_function')) :
function some_function() {
...
}
endif;

Child can now override that function merely by declaring it himself,
but only as long as he's included first.


-Otto


More information about the wp-hackers mailing list