Skip to content

Commit

Permalink
Support <button> or <a> tags
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed May 1, 2024
1 parent 2d2ffbd commit 3473e82
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/compat/wordpress-6.5/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ function gutenberg_block_bindings_replace_html( $block_content, $block_name, str
$selector = 'h[1-6]';
}
if ( 'core/button' === $block_name && 'text' === $attribute_name ) {
$selector = 'a';
// Check if it is a <button> or <a> tag.
if ( preg_match( '/<button[^>]*>.*?<\/button>/', $block_content ) ) {
$selector = 'button';
} else {
$selector = 'a';
}
}
if ( empty( $selector ) ) {
return $block_content;
Expand Down

0 comments on commit 3473e82

Please sign in to comment.