Stop using __DIR__
to load block pattern files
#221
Comments
I tried this and it doesn't work as you described. Using At the very least a child theme could override |
Thanks for looking into it @MaggieCabrera! I think the function that we'd want to use here would be
I don't feel strongly about this and happy to be overruled in favor of better practices for modifying patterns. But here is the scenario I would like to protect against:
|
The filters would allow a pattern to be removed and re-added elsewhere. But it would not allow a child theme to supply a customized block pattern by including their own version of a pattern in their |
Since these are not templates, I'd use |
When reviewing the theme for merge into Core, I noticed that block patterns are being included using
require __DIR__ . '/patterns/' . $block_pattern . '.php'
.I was curious if there was a reason for this. If this gets switched to using something like
get_stylesheet_directory()
, orget_template_directory()
(these may not do exactly what we need), it could become possible for a child theme to include one pattern override file inpatterns
directory.The text was updated successfully, but these errors were encountered: