From 80d2d2a600d40c8107d649738158deda090b665f Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 20 Sep 2026 18:03:34 +0100 Subject: [PATCH] Stop render() throwing when the block content is not a string render_block_core/button runs for every button, and render() returns the content untouched when there is no icon. With strict types on, a null from an earlier filter on the hook made that return a TypeError, so one misbehaving filter elsewhere took down every page with a button on it. --- inc/render.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/render.php b/inc/render.php index 94c51a5..4c0b03e 100644 --- a/inc/render.php +++ b/inc/render.php @@ -45,8 +45,11 @@ function bootstrap(): void { * @return string Filtered block markup. */ function render( $block_content, array $block ): string { - $attributes = $block['attrs'] ?? []; - $icon = icon_markup( $attributes ); + // Another filter on this hook can hand back null, and this runs for every + // button on the site, icon or not. + $block_content = (string) $block_content; + $attributes = $block['attrs'] ?? []; + $icon = icon_markup( $attributes ); if ( '' === $icon ) { return $block_content;