diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/menu.php --- a/wp/wp-admin/menu.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/menu.php Fri Sep 05 18:40:08 2025 +0200 @@ -63,10 +63,9 @@ // $menu[5] = Posts. -$menu[10] = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' ); - $submenu['upload.php'][5] = array( __( 'Library' ), 'upload_files', 'upload.php' ); - /* translators: Add new file. */ - $submenu['upload.php'][10] = array( _x( 'Add New', 'file' ), 'upload_files', 'media-new.php' ); +$menu[10] = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' ); + $submenu['upload.php'][5] = array( __( 'Library' ), 'upload_files', 'upload.php' ); + $submenu['upload.php'][10] = array( __( 'Add New Media File' ), 'upload_files', 'media-new.php' ); $i = 15; foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) { if ( ! $tax->show_ui || ! $tax->show_in_menu ) { @@ -77,10 +76,9 @@ } unset( $tax, $i ); -$menu[15] = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' ); - $submenu['link-manager.php'][5] = array( _x( 'All Links', 'admin menu' ), 'manage_links', 'link-manager.php' ); - /* translators: Add new links. */ - $submenu['link-manager.php'][10] = array( _x( 'Add New', 'link' ), 'manage_links', 'link-add.php' ); +$menu[15] = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' ); + $submenu['link-manager.php'][5] = array( _x( 'All Links', 'admin menu' ), 'manage_links', 'link-manager.php' ); + $submenu['link-manager.php'][10] = array( __( 'Add New Link' ), 'manage_links', 'link-add.php' ); $submenu['link-manager.php'][15] = array( __( 'Link Categories' ), 'manage_categories', 'edit-tags.php?taxonomy=link_category' ); // $menu[20] = Pages. @@ -129,8 +127,11 @@ $menu_icon = 'dashicons-admin-post'; if ( is_string( $ptype_obj->menu_icon ) ) { - // Special handling for data:image/svg+xml and Dashicons. - if ( 0 === strpos( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || 0 === strpos( $ptype_obj->menu_icon, 'dashicons-' ) ) { + // Special handling for an empty div.wp-menu-image, data:image/svg+xml, and Dashicons. + if ( 'none' === $ptype_obj->menu_icon || 'div' === $ptype_obj->menu_icon + || str_starts_with( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) + || str_starts_with( $ptype_obj->menu_icon, 'dashicons-' ) + ) { $menu_icon = $ptype_obj->menu_icon; } else { $menu_icon = esc_url( $ptype_obj->menu_icon ); @@ -163,7 +164,7 @@ */ $core_menu_positions = array( 59, 60, 65, 70, 75, 80, 85, 99 ); while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions, true ) ) { - $ptype_menu_position++; + ++$ptype_menu_position; } $menu[ $ptype_menu_position ] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, $ptype_file, '', $menu_class, $ptype_menu_id, $menu_icon ); @@ -203,15 +204,9 @@ $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' ); if ( wp_is_block_theme() ) { - $submenu['themes.php'][6] = array( - sprintf( - /* translators: %s: "beta" label */ - __( 'Editor %s' ), - '' . __( 'beta' ) . '' - ), - 'edit_theme_options', - 'site-editor.php', - ); + $submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' ); +} else { + $submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?path=/patterns' ); } $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' ); @@ -219,9 +214,7 @@ // Hide Customize link on block themes unless a plugin or theme // is using 'customize_register' to add a setting. if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) { - $position = wp_is_block_theme() ? 7 : 6; - - $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' ); + $submenu['themes.php'][7] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' ); } if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { @@ -230,12 +223,12 @@ if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) { $customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url ); - $submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' ); + $submenu['themes.php'][15] = array( _x( 'Header', 'custom image header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' ); } if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize' ) ) { $customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url ); - $submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' ); + $submenu['themes.php'][20] = array( _x( 'Background', 'custom background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' ); } unset( $customize_url ); @@ -304,8 +297,7 @@ $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' ); if ( ! is_multisite() ) { - /* translators: Add new plugin. */ - $submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' ); + $submenu['plugins.php'][10] = array( __( 'Add New Plugin' ), 'install_plugins', 'plugin-install.php' ); if ( wp_is_block_theme() ) { // Place the menu item below the Theme File Editor menu item. add_action( 'admin_menu', '_add_plugin_file_editor_to_tools', 101 ); @@ -326,9 +318,9 @@ $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php. $submenu['users.php'][5] = array( __( 'All Users' ), 'list_users', 'users.php' ); if ( current_user_can( 'create_users' ) ) { - $submenu['users.php'][10] = array( _x( 'Add New', 'user' ), 'create_users', 'user-new.php' ); + $submenu['users.php'][10] = array( __( 'Add New User' ), 'create_users', 'user-new.php' ); } elseif ( is_multisite() ) { - $submenu['users.php'][10] = array( _x( 'Add New', 'user' ), 'promote_users', 'user-new.php' ); + $submenu['users.php'][10] = array( __( 'Add New User' ), 'promote_users', 'user-new.php' ); } $submenu['users.php'][15] = array( __( 'Profile' ), 'read', 'profile.php' ); @@ -342,11 +334,37 @@ } } +$site_health_count = ''; +if ( ! is_multisite() && current_user_can( 'view_site_health_checks' ) ) { + $get_issues = get_transient( 'health-check-site-status-result' ); + + $issue_counts = array(); + + if ( false !== $get_issues ) { + $issue_counts = json_decode( $get_issues, true ); + } + + if ( ! is_array( $issue_counts ) || ! $issue_counts ) { + $issue_counts = array( + 'good' => 0, + 'recommended' => 0, + 'critical' => 0, + ); + } + + $site_health_count = sprintf( + '%s', + $issue_counts['critical'], + number_format_i18n( $issue_counts['critical'] ) + ); +} + $menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' ); $submenu['tools.php'][5] = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' ); $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' ); $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' ); - $submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' ); + /* translators: %s: Number of critical Site Health checks. */ + $submenu['tools.php'][20] = array( sprintf( __( 'Site Health %s' ), $site_health_count ), 'view_site_health_checks', 'site-health.php' ); $submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' ); $submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' ); if ( is_multisite() && ! is_main_site() ) {