Commit 2a9a5d9eebb for woocommerce

commit 2a9a5d9eebb3904954feb625f5c950ef32a1370f
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Thu Jun 25 11:49:49 2026 +0200

    Decode HTML entities in WooCommerce pattern titles (#65969)

    * Decode HTML entities in PTK pattern titles

    * Add changelog

    * Wrap title in wp_strip_all_tags()

diff --git a/plugins/woocommerce/changelog/fix-43332-decode-pattern-titles b/plugins/woocommerce/changelog/fix-43332-decode-pattern-titles
new file mode 100644
index 00000000000..fe0ab708b45
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-43332-decode-pattern-titles
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Decode HTML entities in PTK pattern titles
diff --git a/plugins/woocommerce/src/Blocks/Patterns/PatternRegistry.php b/plugins/woocommerce/src/Blocks/Patterns/PatternRegistry.php
index 1b88a550c60..dc7177ac5de 100644
--- a/plugins/woocommerce/src/Blocks/Patterns/PatternRegistry.php
+++ b/plugins/woocommerce/src/Blocks/Patterns/PatternRegistry.php
@@ -143,7 +143,7 @@ class PatternRegistry {
 		}

 		// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.LowLevelTranslationFunction
-		$pattern_data['title'] = translate_with_gettext_context( $pattern_data['title'], 'Pattern title', 'woocommerce' );
+		$pattern_data['title'] = translate_with_gettext_context( wp_strip_all_tags( html_entity_decode( (string) $pattern_data['title'], ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ), 'Pattern title', 'woocommerce' );
 		if ( ! empty( $pattern_data['description'] ) ) {
 			// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.LowLevelTranslationFunction
 			$pattern_data['description'] = translate_with_gettext_context( $pattern_data['description'], 'Pattern description', 'woocommerce' );
@@ -175,7 +175,6 @@ class PatternRegistry {
 		register_block_pattern( $pattern_data['slug'], $pattern_data );
 	}

-
 	/**
 	 * Convert a kebab-case string to capital case.
 	 *
diff --git a/plugins/woocommerce/tests/php/src/Blocks/Patterns/PatternRegistryTest.php b/plugins/woocommerce/tests/php/src/Blocks/Patterns/PatternRegistryTest.php
index 394f92fc6d5..35f0ee30931 100644
--- a/plugins/woocommerce/tests/php/src/Blocks/Patterns/PatternRegistryTest.php
+++ b/plugins/woocommerce/tests/php/src/Blocks/Patterns/PatternRegistryTest.php
@@ -178,6 +178,25 @@ class PatternRegistryTest extends \WP_UnitTestCase {
 		);
 	}

+	/**
+	 * Test HTML entities are decoded in pattern titles.
+	 */
+	public function test_html_entities_are_decoded_in_pattern_title() {
+		$pattern = [
+			'title'   => 'Featured Products: Fresh &amp; Tasty',
+			'slug'    => 'my-pattern',
+			'content' => '<!-- wp:group {"metadata":{"name":"Sweet Organic Lemons"}} -->
+<div class="wp-block-group"></div>
+<!-- /wp:group -->',
+		];
+
+		$this->pattern_registry->register_block_pattern( 'source', $pattern, [] );
+
+		$registered_pattern = \WP_Block_Patterns_Registry::get_instance()->get_registered( $pattern['slug'] );
+
+		$this->assertSame( 'Featured Products: Fresh & Tasty', $registered_pattern['title'] );
+	}
+
 	/**
 	 * Enable the feature flag.
 	 *