function.php parent and child

I have read up on the the function.php in both parent and child theme and that the child one is loaded first.

I have found that scripts I have been given to add to functions.php don't always work when put in the child one, but work fine in the parent one - which is not ideal as it gets lost with an upgrade or has to be redone with each theme upgrade.

I would like to get some advice and perhaps clarification about function.php when using a child theme and possibly why it doesn't work when code is added to child.


  • Mason
    • DEV MAN’s Sidekick

    Hiya AquaPebble,

    It sounds like you understand the relationship correctly and the child should definitely override the parent function.

    Can you give us a specific example (maybe some exact code and the theme you are using it with) that doesn't work as you expect?

    We can take a look and provide some light on the subject for ya.


  • AquaPebble
    • The Incredible Code Injector

    @masonjames. Thanks.

    There are a few questions I have that perhaps I should ask:

    Do you just add code to the child function.php after the opening php tag?
    What I am unsure about is with it loading first are there certain requirements that need to be in there first? For example should we paste what is in the parent function php in there and just leave the parent empty or as I have been doing is just adding code.

    I am really unsure about the implications of the child file loading first.


  • Richie_KS
    • HummingBird

    you'll have to create a new functions.php in child theme...the functions.php from parent will auto inherit
    to child theme so start with blank functions.php in child theme.

    depends on the code..what's thecode/function you added in child theme that didn't work?


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.