63 |
68 |
64 // $menu[5] = Posts. |
69 // $menu[5] = Posts. |
65 |
70 |
66 $menu[10] = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' ); |
71 $menu[10] = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' ); |
67 $submenu['upload.php'][5] = array( __( 'Library' ), 'upload_files', 'upload.php' ); |
72 $submenu['upload.php'][5] = array( __( 'Library' ), 'upload_files', 'upload.php' ); |
68 $submenu['upload.php'][10] = array( __( 'Add New Media File' ), 'upload_files', 'media-new.php' ); |
73 $submenu['upload.php'][10] = array( __( 'Add Media File' ), 'upload_files', 'media-new.php' ); |
69 $i = 15; |
74 $i = 15; |
70 foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) { |
75 foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) { |
71 if ( ! $tax->show_ui || ! $tax->show_in_menu ) { |
76 if ( ! $tax->show_ui || ! $tax->show_in_menu ) { |
72 continue; |
77 continue; |
73 } |
78 } |
76 } |
81 } |
77 unset( $tax, $i ); |
82 unset( $tax, $i ); |
78 |
83 |
79 $menu[15] = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' ); |
84 $menu[15] = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' ); |
80 $submenu['link-manager.php'][5] = array( _x( 'All Links', 'admin menu' ), 'manage_links', 'link-manager.php' ); |
85 $submenu['link-manager.php'][5] = array( _x( 'All Links', 'admin menu' ), 'manage_links', 'link-manager.php' ); |
81 $submenu['link-manager.php'][10] = array( __( 'Add New Link' ), 'manage_links', 'link-add.php' ); |
86 $submenu['link-manager.php'][10] = array( __( 'Add Link' ), 'manage_links', 'link-add.php' ); |
82 $submenu['link-manager.php'][15] = array( __( 'Link Categories' ), 'manage_categories', 'edit-tags.php?taxonomy=link_category' ); |
87 $submenu['link-manager.php'][15] = array( __( 'Link Categories' ), 'manage_categories', 'edit-tags.php?taxonomy=link_category' ); |
83 |
88 |
84 // $menu[20] = Pages. |
89 // $menu[20] = Pages. |
85 |
90 |
86 // Avoid the comment count query for users who cannot edit_posts. |
91 // Avoid the comment count query for users who cannot edit_posts. |
167 ++$ptype_menu_position; |
172 ++$ptype_menu_position; |
168 } |
173 } |
169 |
174 |
170 $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 ); |
175 $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 ); |
171 $submenu[ $ptype_file ][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $ptype_file ); |
176 $submenu[ $ptype_file ][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $ptype_file ); |
172 $submenu[ $ptype_file ][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, $post_new_file ); |
177 $submenu[ $ptype_file ][10] = array( $ptype_obj->labels->add_new_item, $ptype_obj->cap->create_posts, $post_new_file ); |
173 |
178 |
174 $i = 15; |
179 $i = 15; |
175 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { |
180 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { |
176 if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array( $ptype, (array) $tax->object_type, true ) ) { |
181 if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array( $ptype, (array) $tax->object_type, true ) ) { |
177 continue; |
182 continue; |
204 $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' ); |
209 $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' ); |
205 |
210 |
206 if ( wp_is_block_theme() ) { |
211 if ( wp_is_block_theme() ) { |
207 $submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' ); |
212 $submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' ); |
208 } else { |
213 } else { |
209 $submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?path=/patterns' ); |
214 $supports_stylebook = ( current_theme_supports( 'editor-styles' ) || wp_theme_has_theme_json() ); |
|
215 |
|
216 if ( $supports_stylebook ) { |
|
217 $submenu['themes.php'][6] = array( _x( 'Design', 'design menu item' ), 'edit_theme_options', 'site-editor.php' ); |
|
218 } else { |
|
219 $submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?p=/pattern' ); |
|
220 } |
210 } |
221 } |
211 |
222 |
212 $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' ); |
223 $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' ); |
213 |
224 |
214 // Hide Customize link on block themes unless a plugin or theme |
225 // Hide Customize link on block themes unless a plugin or theme |
295 $menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' ); |
306 $menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' ); |
296 |
307 |
297 $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' ); |
308 $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' ); |
298 |
309 |
299 if ( ! is_multisite() ) { |
310 if ( ! is_multisite() ) { |
300 $submenu['plugins.php'][10] = array( __( 'Add New Plugin' ), 'install_plugins', 'plugin-install.php' ); |
311 $submenu['plugins.php'][10] = array( __( 'Add Plugin' ), 'install_plugins', 'plugin-install.php' ); |
301 if ( wp_is_block_theme() ) { |
312 if ( wp_is_block_theme() ) { |
302 // Place the menu item below the Theme File Editor menu item. |
313 // Place the menu item below the Theme File Editor menu item. |
303 add_action( 'admin_menu', '_add_plugin_file_editor_to_tools', 101 ); |
314 add_action( 'admin_menu', '_add_plugin_file_editor_to_tools', 101 ); |
304 } else { |
315 } else { |
305 $submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); |
316 $submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); |
316 |
327 |
317 if ( current_user_can( 'list_users' ) ) { |
328 if ( current_user_can( 'list_users' ) ) { |
318 $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php. |
329 $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php. |
319 $submenu['users.php'][5] = array( __( 'All Users' ), 'list_users', 'users.php' ); |
330 $submenu['users.php'][5] = array( __( 'All Users' ), 'list_users', 'users.php' ); |
320 if ( current_user_can( 'create_users' ) ) { |
331 if ( current_user_can( 'create_users' ) ) { |
321 $submenu['users.php'][10] = array( __( 'Add New User' ), 'create_users', 'user-new.php' ); |
332 $submenu['users.php'][10] = array( __( 'Add User' ), 'create_users', 'user-new.php' ); |
322 } elseif ( is_multisite() ) { |
333 } elseif ( is_multisite() ) { |
323 $submenu['users.php'][10] = array( __( 'Add New User' ), 'promote_users', 'user-new.php' ); |
334 $submenu['users.php'][10] = array( __( 'Add User' ), 'promote_users', 'user-new.php' ); |
324 } |
335 } |
325 |
336 |
326 $submenu['users.php'][15] = array( __( 'Profile' ), 'read', 'profile.php' ); |
337 $submenu['users.php'][15] = array( __( 'Profile' ), 'read', 'profile.php' ); |
327 } else { |
338 } else { |
328 $_wp_real_parent_file['users.php'] = 'profile.php'; |
339 $_wp_real_parent_file['users.php'] = 'profile.php'; |
329 $submenu['profile.php'][5] = array( __( 'Profile' ), 'read', 'profile.php' ); |
340 $submenu['profile.php'][5] = array( __( 'Profile' ), 'read', 'profile.php' ); |
330 if ( current_user_can( 'create_users' ) ) { |
341 if ( current_user_can( 'create_users' ) ) { |
331 $submenu['profile.php'][10] = array( __( 'Add New User' ), 'create_users', 'user-new.php' ); |
342 $submenu['profile.php'][10] = array( __( 'Add User' ), 'create_users', 'user-new.php' ); |
332 } elseif ( is_multisite() ) { |
343 } elseif ( is_multisite() ) { |
333 $submenu['profile.php'][10] = array( __( 'Add New User' ), 'promote_users', 'user-new.php' ); |
344 $submenu['profile.php'][10] = array( __( 'Add User' ), 'promote_users', 'user-new.php' ); |
334 } |
345 } |
335 } |
346 } |
336 |
347 |
337 $site_health_count = ''; |
348 $site_health_count = ''; |
338 if ( ! is_multisite() && current_user_can( 'view_site_health_checks' ) ) { |
349 if ( ! is_multisite() && current_user_can( 'view_site_health_checks' ) ) { |