'show_in_menu' => true,
));
$builtin = array
( 'post', 'page'
);
foreach ( array_merge( $builtin,
$types ) as $ptype ) { $ptype_obj =
get_post_type_object( $ptype );
// Check if it should be a submenu.
if ( true !==
$ptype_obj->show_in_menu
) { 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 );
$menu_icon = 'dashicons-admin-post';
if ( is_string( $ptype_obj->menu_icon
) ) { // Special handling for data:image/svg+xml and Dashicons.
if ( 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
);
} } elseif ( in_array( $ptype,
$builtin, true
) ) { $menu_icon = 'dashicons-admin-' .
$ptype;
}