Skip to content

Conversation

@adamziel
Copy link
Contributor

Backports php-toolkit PR 191:

Before this PR, BlockMarkupProcessor (and BlockMarkupUrlProcessor) would lose the self-closing solidus when rewriting block attributes:

$p = new BlockMarkupUrlProcessor(
	'<!-- wp:navigation-link {"url": "https://w.org"} /-->'
);
$p->next_url();
$p->set_url('https://new-site.org', WPURL::parse('https://new-site.org'));
echo $p->__toString();
// <!-- wp:navigation-link {"url": "https://new-site.org"} -->

With this PR, the self-closing solidus is preserved:

$p = new BlockMarkupUrlProcessor(
	'<!-- wp:navigation-link {"url": "https://w.org"} /-->'
);
$p->next_url();
$p->set_url('https://new-site.org', WPURL::parse('https://new-site.org'));
echo $p->__toString();
// <!-- wp:navigation-link {"url": "https://new-site.org"} /-->

Testing instructions

CI – the php-toolkit PR has its own tests and this WordPress importer PR also comes with an additional check to ensure self-closing blocks are preserved.

@adamziel adamziel merged commit c5ea8c3 into WordPress:master Oct 10, 2025
24 checks passed
@adamziel adamziel deleted the backport-preserving-self-closing-blocks branch October 10, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants