Custom Post Types – Change order of menu items

Here is an example of one way I have managed to edits those:

function wpse_custom_menu_order( $menu_ord ) {
    if ( !$menu_ord ) return true;

    return array(
        'index.php', // Dashboard
        'separator1', // First separator
        'edit.php', // Posts
        'upload.php', // Media
        'link-manager.php', // Links
        'edit-comments.php', // Comments
        'edit.php?post_type=page', // Pages
        'separator2', // Second separator
        'themes.php', // Appearance
        'plugins.php', // Plugins
        'users.php', // Users
        'tools.php', // Tools
        'options-general.php', // Settings
        'separator-last', // Last separator
    );
}
add_filter( 'custom_menu_order', 'wpse_custom_menu_order', 10, 1 );
add_filter( 'menu_order', 'wpse_custom_menu_order', 10, 1 );

More info:

https://developer.wordpress.org/reference/hooks/custom_menu_order/
https://developer.wordpress.org/reference/hooks/menu_order/

I have found using this plugin to be the smoothest also you can poke around the code to see how they do it: https://wordpress.org/plugins/admin-menu-editor/. Its a free plugin!