Child Theme Performance

I’ve read a lot of discussions here and elsewhere about creating a child theme being the recommended way to create a theme based on some other existing theme.

I’d like to know about possible performance disadvantages of such approach, compared to creating a non-child theme.

Read More

It seems that a parent-and-child-theme approach has to deal with loading a hell of a lot more files than a single theme – unless I’m missing something in the codex explanation. And if so, it has to slow down loading, probably significantly.

I would appreciate if someone could clarify this for me.

Related posts

1 comment

  1. When you set a child theme, basically WP looks into 2 directories to see if there are some overriding to make. So it adds some impact on performance. The use of @import in child CSS can also have some bad impact on performance grade.

    Most of the time, it depends on the parent’s theme quality. For example if the developer has prepared his theme for child theme you should find a if( !function_exists() ) before his functions. That allows you to easily modify function in your child theme simply because child functions.php is loaded before unlike other files.

    What I like to do to customize a child theme is to add my own class to the body and play with selectors because I hate using !important in CSS code :

    add_filter('body_class','_add_child_theme_body_class');
    function _add_child_theme_body_class($classes) {
    $classes[] = 'your-class';
    return $classes;
    }
    

    Then I can style like that :

    .your-class #page {}
    

    You have to ask yourself about what you want to do. We use child theme for maintenance. But performance is definitely a drawback.

    You may counterbalance this with some good caching solution.

Comments are closed.