$item) { // Check if menu item is a separator if ( false !== strpos( $item[4], 'wp-menu-separator' ) ) { unset( $menu[ $key ] ); } } } } /** * Add custom menu items */ // Add WordPress Admin menu item conditionally add_action('admin_menu', function () { // Reset to Helix mode when accessing Helix page (do this before checking the option) if (isset($_GET['page']) && $_GET['page'] === 'helix') { update_option('helix_use_default_admin', false); } // Only show the "WordPress Admin" link when in Helix mode. $use_default_admin = get_option('helix_use_default_admin', false); if ($use_default_admin) { return; } // Add a menu item to go back to default WordPress admin add_menu_page( 'WordPress Admin', // Page title 'WordPress Admin', // Menu title 'read', // Capability 'wordpress-admin', // Menu slug 'wordpress_admin_callback', // Callback function 'dashicons-wordpress', // Icon 2 // Position (after main Helix menu) ); }, 1000); // Higher priority to run after menu removal // Add custom Helix menu items (only when on Helix page) add_action('admin_menu', function () { // Only add when on Helix page if (!isset($_GET['page']) || $_GET['page'] !== 'helix') { return; } // Example: Add a Posts menu item add_menu_page( 'Helix Posts', 'Posts', 'edit_posts', 'helix-posts', 'helix_posts_callback', 'dashicons-admin-post', 3 ); // Example: Add a Users menu item add_menu_page( 'Helix Users', 'Users', 'list_users', 'helix-users', 'helix_users_callback', 'dashicons-admin-users', 4 ); }, 1001); // Even higher priority to run after WordPress Admin menu // Callback functions for custom menu items function wordpress_admin_callback() { // Set the option to use default WordPress admin update_option('helix_use_default_admin', true); // Show a clean message and let the user navigate naturally ?>
You can now navigate to any WordPress admin page normally.