From 330cc844567a7c044724a1f694a29cc911c54937 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Mon, 4 Aug 2025 12:15:17 +0100 Subject: [PATCH] Fixes an issue where all occurances of "_Block" were stripped from folder names. We just want to strip this from the end. --- includes/make-block/services/class-block-details.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/make-block/services/class-block-details.php b/includes/make-block/services/class-block-details.php index df81b8f..f1b528c 100644 --- a/includes/make-block/services/class-block-details.php +++ b/includes/make-block/services/class-block-details.php @@ -63,7 +63,10 @@ public function get_block_slug_name(): string { $block_class_name = $this->get_block_class_name(); // Remove the _Block suffix. - $block_class_name = str_replace( '_Block', '', $block_class_name ); + if ( str_ends_with( $block_class_name, '_Block' ) ) { + // Remove the last 6 characters due to the underscore and the 5 characters of the suffix. + $block_class_name = substr( $block_class_name, 0, -6 ); + } return strtolower( str_replace( '_', '-', $block_class_name ) ); }