Path problems for Customizer in child themes
-
I had problems with the customizer.php failing with a list of 404 errors on various includes when I was using a child theme. The issue is that there’s a few places where get_stylesheet_directory_uri() is used which assumes that the files will be pulled from whatever the current theme is (in this case my child theme) but that may not necessarily be the case.
For example:
shamrock\include\options\core\class-kirki-init.php
This sets a class URL by get_stylesheet_directory_uri() but references it in many of the enqueue hooks as a path to the parent theme. They should be using get_template_directory_uri() instead, which will return URL specifically for the parent theme.
We can see Kirki::$url is used many times throughout the theme, lots of enqueues in
shamrock\include\options\controls\php\class-kirki-control-base.php
I was able to correct the problem by copying the entire assets directory into my child theme, but I thought you might want to resolve this in the theme itself.
- The topic ‘Path problems for Customizer in child themes’ is closed to new replies.