diff --git a/php-transformer/src/HtmlToBlocks/BlockFactory.php b/php-transformer/src/HtmlToBlocks/BlockFactory.php
index ddb06e56..51871f20 100644
--- a/php-transformer/src/HtmlToBlocks/BlockFactory.php
+++ b/php-transformer/src/HtmlToBlocks/BlockFactory.php
@@ -141,14 +141,7 @@ private function blockHtml(string $name, array $attrs, array $innerBlocks): stri
}
if ( 'core/icon' === $name ) {
- $support = $this->styleSupport($attrs['style'] ?? null);
- $iconAttrs = array(
- 'class' => $this->mergeClassNames('wp-block-icon', $support['classes'], (string) ($attrs['className'] ?? '')),
- 'style' => $support['style'],
- 'aria-label' => (string) ($attrs['label'] ?? ''),
- 'aria-hidden' => ! empty($attrs['ariaHidden']) ? 'true' : '',
- );
- return '
htmlAttrs($iconAttrs) . '>' . ($attrs['svg'] ?? '') . '
';
+ return '';
}
if ( 'core/preformatted' === $name ) {
diff --git a/php-transformer/src/HtmlToBlocks/HtmlTransformer.php b/php-transformer/src/HtmlToBlocks/HtmlTransformer.php
index 8a694a59..3cdd89ec 100644
--- a/php-transformer/src/HtmlToBlocks/HtmlTransformer.php
+++ b/php-transformer/src/HtmlToBlocks/HtmlTransformer.php
@@ -4247,14 +4247,51 @@ private function inlineSvgBlockFromElement(DOMElement $element): ?array
return null;
}
- // Keep illustrative/decorative inline SVG inline as a core/html block.
- // Externalizing to an `assets/*.svg` file + core/image would be lost in
- // WordPress, which blocks SVG uploads by default. The markup is already
- // safe-sanitized above (scripts, event handlers, foreignObject, and
- // javascript: URLs stripped via sanitizeInlineSvgMarkup + verified by
- // isSafeSvgContent), and the original outer SVG preserves
- // viewBox/role/aria-label/class.
- return $this->createBlock('core/html', array( 'content' => $this->restoreSvgCasing($html) ), array(), $element);
+ // core/icon is dynamic and references registered icon names; it cannot
+ // carry arbitrary imported SVG markup. Keep illustrative/decorative SVGs
+ // inline as sanitized core/html, but make viewBox-only SVGs explicitly
+ // bounded so they do not render oversized if source CSS is unavailable.
+ return $this->createBlock('core/html', array( 'content' => $this->restoreSvgCasing($this->ensureInlineSvgSizing($html)) ), array(), $element);
+ }
+
+ private function ensureInlineSvgSizing(string $html): string
+ {
+ if ( 1 !== preg_match('/