Undefined Array for the filter ‘get_block_templates’ when the file theme.json
-
Hello team,
we’ve discovered a small bug that causes several warnings: https://prnt.sc/-MW7Pg4-yz7n
We’ve tested it on multiple non-FSE themes.
The problem is in the theme-bridge.php file on the line “Random the top template”. The code refers to the 1st element of the array $templates without checking if the array has any elements at all: https://prnt.sc/lmge5L3GADgt. And if the array is empty – it causes WP warnings.
The thing is that all modern themes (block themes and non-block themes) generate the theme.json file (a requirement of modern marketplaces). So, even if it is just an Elementor-based theme (not a block theme) they still may have this theme.json file among their files, but it will not have any templates in it.
So, could you please add a simple check for your filter get_block_templates that checks if the array $templates have any elements before referring to the 1st element? This will resolve these warnings.
Thank you in advance.
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.