*/
/**
- * Constructs the admin menu bar.
+ * Constructs the admin menu.
*
* The elements in the array are :
* 0: Menu item name
$i = 15;
foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
- if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )
+ if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) )
continue;
$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
/* translators: add new file */
$submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
- if ( ! $tax->show_ui )
+ if ( ! $tax->show_ui || ! $tax->show_in_menu )
continue;
$submenu['upload.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=attachment' );
$submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' );
$i = 15;
foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
- if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )
+ if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('page', (array) $tax->object_type, true) )
continue;
$submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' );
continue;
$ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
$ptype_for_id = sanitize_html_class( $ptype );
+
if ( is_string( $ptype_obj->menu_icon ) ) {
- $menu_icon = esc_url( $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-' ) ) {
+ $menu_icon = $ptype_obj->menu_icon;
+ } else {
+ $menu_icon = esc_url( $ptype_obj->menu_icon );
+ }
$ptype_class = $ptype_for_id;
} else {
$menu_icon = 'none';
$i = 15;
foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
- if ( ! $tax->show_ui || ! in_array($ptype, (array) $tax->object_type, true) )
+ if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) )
continue;
$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );