PluginProbe
Gutenberg / 24.0.0
Gutenberg v24.0.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/scripts/block-library/pattern.php +5 -5 23.3.124.0.0 View file →
@@ -32,13 +32,13 @@
32 32 */
33 33 function gutenberg_render_block_core_pattern( $attributes ) {
34 34 static $seen_refs = array();
35 35
36 - if ( empty( $attributes['slug'] ) ) {
36 + $slug = $attributes['slug'] ?? null;
37 + if ( empty( $slug ) || ! is_string( $slug ) ) {
37 38 return '';
38 39 }
39 40
40 - $slug = $attributes['slug'];
41 41 $registry = WP_Block_Patterns_Registry::get_instance();
42 42
43 43 if ( ! $registry->is_registered( $slug ) ) {
44 44 return '';
@@ -43,9 +43,9 @@
43 43 if ( ! $registry->is_registered( $slug ) ) {
44 44 return '';
45 45 }
46 46
47 - if ( isset( $seen_refs[ $attributes['slug'] ] ) ) {
47 + if ( isset( $seen_refs[ $slug ] ) ) {
48 48 // WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
49 49 // is set in `wp_debug_mode()`.
50 50 $is_debug = WP_DEBUG && WP_DEBUG_DISPLAY;
51 51
@@ -57,9 +57,9 @@
57 57
58 58 $pattern = $registry->get_registered( $slug );
59 59 $content = $pattern['content'];
60 60
61 - $seen_refs[ $attributes['slug'] ] = true;
61 + $seen_refs[ $slug ] = true;
62 62
63 63 $content = do_blocks( $content );
64 64
65 65 global $wp_embed;
@@ -64,9 +64,9 @@
64 64
65 65 global $wp_embed;
66 66 $content = $wp_embed->autoembed( $content );
67 67
68 - unset( $seen_refs[ $attributes['slug'] ] );
68 + unset( $seen_refs[ $slug ] );
69 69 return $content;
70 70 }
71 71
72 72 add_action( 'init', 'gutenberg_register_block_core_pattern', 20 );