Is it possible to make grandchild themes?

Sort of “Yes” as a technicality, in practice No.

You can specify a child parent as the parent theme, nothing stops this, and WordPress would attempt to use it.

However

You will run into major issues, not to mention that the core devs have explicitly stated that this is not desirable behaviour, and they will not make efforts to support grandchild themes.

For example, WP API’s make a distinction between stylesheet and template URLs/directories, where stylesheet always refers to the active theme, and template refers to the parent theme, but if a grandparent theme is included, does get_template_directory_uri reference the parent or the grandparent? Lots of API calls are now ambiguous, and different people would expect different behaviour, including code that’s in core. You’d also need to load the functions.php of either the parent or grandparent, and make sure that it’s done in the correct order.

It’s also considered very bad practice. If you have a need for grandchild themes then your approach has taken a wrong turn, and you need to step back and re-evaluate things.

I would advise you avoid the concept of grandchild themes, it will lead to more problems. Instead more hooks filters actions and modularity in your child theme should enable you to keep the child themes shared components the same, and let you branch/fork with little difficulty. Try moving common elements into an svn external/git submodule.

There’s also the _s model where you have your child theme as a base, and fork it, rather than having it as a parent with the intention you work on the copy, rather than a child/override.

Leave a Comment

tech