Is it good practice to use children functions.php to override parent core functions?

Example in Storefront theme :

Core function

if ( ! function_exists( 'storefront_primary_navigation_wrapper' ) ) {
     * The primary navigation wrapper
    function storefront_primary_navigation_wrapper() {
        echo '<div class="storefront-primary-navigation"><div class="col-full">';

children functions.php

  function storefront_primary_navigation_wrapper() {
      // modified content;
  • depends on your programming style. It´s made possible for being used, isn´t it?
    – am_
    Aug 22, 2018 at 13:12
  • The only reason if ! function_exists( is even there is to allow you to do this, so yes, it's fine. Aug 22, 2018 at 15:48

1 Answer 1


Basically, that is what Child Themes are meant to be, you have the need to modify the theme, but you shouldn't do it directly on the theme since the updates will mess you up, instead, you do all your customizations and new features on your Child Theme so you will be alright.

From codex.

If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.

It's a good practice, to sum up.

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.