PluginProbe
Gutenberg / 19.6.1
Gutenberg v19.6.1
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
gutenberg / lib / compat / wordpress-6.6 / compat.php

compat.php in Gutenberg 19.6.1, at lib/compat/wordpress-6.6/compat.php

33 lines 968 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WordPress 6.6 compatibility functions.
4 *
5 * @package gutenberg
6 */
7
8 /**
9 * Change the Patterns submenu link and remove the Template Parts submenu for
10 * the Classic theme. This function should not be backported to core, and should be
11 * removed when the required WP core version for Gutenberg is >= 6.6.0.
12 *
13 * @global array $submenu
14 */
15 function gutenberg_change_patterns_link_and_remove_template_parts_submenu_item() {
16 if ( ! wp_is_block_theme() ) {
17 global $submenu;
18
19 if ( empty( $submenu['themes.php'] ) ) {
20 return;
21 }
22
23 foreach ( $submenu['themes.php'] as $key => $item ) {
24 if ( 'edit.php?post_type=wp_block' === $item[2] ) {
25 $submenu['themes.php'][ $key ][2] = 'site-editor.php?path=/patterns';
26 } elseif ( 'site-editor.php?path=/wp_template_part/all' === $item[2] ) {
27 unset( $submenu['themes.php'][ $key ] );
28 }
29 }
30 }
31 }
32 add_action( 'admin_init', 'gutenberg_change_patterns_link_and_remove_template_parts_submenu_item' );
33