| 1 |
<?php |
| 2 |
/** |
| 3 |
* Moves the theme editor menu items for FSE themes. |
| 4 |
* |
| 5 |
* @package gutenberg |
| 6 |
*/ |
| 7 |
|
| 8 |
/* |
| 9 |
* If wp_list_users is defined, it means the plugin |
| 10 |
* is running on WordPress 5.9, so no need to change menu location. |
| 11 |
*/ |
| 12 |
if ( ! function_exists( 'wp_list_users' ) ) { |
| 13 |
/** |
| 14 |
* Moves the "theme editor" under "tools" in block themes. |
| 15 |
*/ |
| 16 |
function gutenberg_move_theme_editor_in_block_themes() { |
| 17 |
if ( ! wp_is_block_theme() || is_multisite() ) { |
| 18 |
return; |
| 19 |
} |
| 20 |
remove_submenu_page( 'themes.php', 'theme-editor.php' ); |
| 21 |
add_submenu_page( 'tools.php', __( 'Theme File Editor', 'gutenberg' ), __( 'Theme File Editor', 'gutenberg' ), 'edit_themes', 'theme-editor.php' ); |
| 22 |
} |
| 23 |
add_action( 'admin_menu', 'gutenberg_move_theme_editor_in_block_themes', 102 ); |
| 24 |
} |
| 25 |
|