| @@ -38,8 +38,11 @@ | ||
| 38 | 38 | |
| 39 | 39 | // Remove Appearance > Theme Editor. |
| 40 | 40 | remove_submenu_page( 'themes.php', 'theme-editor.php' ); |
| 41 | 41 | |
| 42 | + // Remove Appearance > Editor. | |
| 43 | + remove_submenu_page( 'themes.php', 'site-editor.php' ); | |
| 44 | + | |
| 42 | 45 | // Remove Appearance > Widgets. |
| 43 | 46 | remove_submenu_page( 'themes.php', 'widgets.php' ); |
| 44 | 47 | |
| 45 | 48 | /** |
| @@ -78,8 +81,9 @@ | ||
| 78 | 81 | } |
| 79 | 82 | |
| 80 | 83 | $wp_admin_bar->remove_menu( 'customize' ); |
| 81 | 84 | $wp_admin_bar->remove_node( 'themes' ); |
| 85 | + $wp_admin_bar->remove_node( 'site-editor' ); | |
| 82 | 86 | $wp_admin_bar->remove_node( 'widgets' ); |
| 83 | 87 | } |
| 84 | 88 | |
| 85 | 89 | add_action( 'current_screen', __NAMESPACE__ . '\\prevent_admin_page_access' ); |
| @@ -92,11 +96,16 @@ | ||
| 92 | 96 | if ( ! is_themes_disabled() ) { |
| 93 | 97 | return; |
| 94 | 98 | } |
| 95 | 99 | |
| 100 | + $disabled_screens = array( | |
| 101 | + 'site-editor', | |
| 102 | + 'themes', | |
| 103 | + ); | |
| 104 | + | |
| 96 | 105 | $screen = get_current_screen(); |
| 97 | 106 | |
| 98 | - if ( is_object( $screen ) && 'themes' === $screen->id ) { | |
| 107 | + if ( is_object( $screen ) && in_array( $screen->id, $disabled_screens, true ) ) { | |
| 99 | 108 | wp_safe_redirect( admin_url() ); |
| 100 | 109 | exit; |
| 101 | 110 | } |
| 102 | 111 | } |