PluginProbe
Gutenberg / 8.3.0
Gutenberg v8.3.0
24.1.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 All 404 releases
← All changes | lib/block-directory.php +18 -0 7.4.0 → 8.3.0 View file →
@@ -17,5 +17,23 @@
17 17 wp_enqueue_script( 'wp-block-directory' );
18 18 wp_enqueue_style( 'wp-block-directory' );
19 19 }
20 20 add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_block_editor_assets_block_directory' );
21 +
22 + /**
23 + * Add data attribute of handle to all script tags output in the wp-admin.
24 + *
25 + * @param string $tag The `<script>` tag for the enqueued script.
26 + * @param string $handle The script's registered handle.
27 + *
28 + * @return string Filter script tag.
29 + */
30 + function gutenberg_change_script_tag( $tag, $handle ) {
31 + if ( ! is_admin() ) {
32 + return $tag;
33 + }
34 + $tag = str_replace( '<script ', sprintf( '<script data-handle="%s" ', esc_attr( $handle ) ), $tag );
35 +
36 + return $tag;
37 + }
38 + add_filter( 'script_loader_tag', 'gutenberg_change_script_tag', 10, 2 );
21 39 }