I can see a few issues with this approach:
- If the user doesn’t belong to a site yet, they won’t get redirected correctly because
$redirect_url
won’t be defined. - If the user belongs to more than 1 site, they will always be redirected to the site with the lowest ID, not necessarily the one they’re trying to log into.
Have you tried any Azure SSO plugins? I built an intranet for a client that uses Azure for employees to log into the site, and we had great results using Single Sign-on with Azure Active Directory (for WordPress). It’s supposed to work with multisite; you’ll just need to make sure it’s configured correctly on each site.
Related Posts:
- How do I create a custom role capability?
- Prevent network activation of plugin
- Uninstall script for a plugin in Multisite
- Changing Plugin Load Order
- What is wrong with using add_option with Multisite instead of add_blog_option in a plugin
- How to Get a List of Sub Blogs without Using get_blog_list()?
- Cron firing my function everytime wp-admin is visited
- Error getting correct blog_id on MU from functions.php
- How do I make specific plugin functionality apply to different sites in a network?
- WordPress multisite apply different options over each site from same plugin
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- Multisite, sharing content by URL
- Only allow plugin to be activated on root site of multisite
- How to use wp_set_password in a plugin?
- WordPress Media mime type filter problem 4.0
- What is the best way to overwrite /wp-admin/ms-delete-site.php
- Where should I store global data for my multi-site WordPress plugin?
- unable to stop loop when using wp_insert_post with publish_post hook
- Customize multisite site creation with user data
- Multisite plugin development and wp_enqueue_script
- Plugin Uninstall and Deactivate via Options Menu
- how to activate plugin network-wide, and save setting across sites
- Sharing a common set of image files for media library, across all sites within multisite
- What is difference between blog id and site id?
- How to create a Tools menu on the Network Admin dashboard from a plugin
- Override the default Add/Edit site forms of the Network Panel in custom plugin
- How to set “Site Address (URL)” programmatically on WP multisite?
- How to associate an existing user to a site in a multisite setup programmatically
- How To Change Post Author Default?
- Adding (blog-specific) links to “My Sites” admin page
- Plugin menu addition in multisite
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Multiple Plugin best practice in Multisite
- Selectively update themes in WordPress multisite
- Problem with context in multisite – getting main site data in every blog (get_pages())
- how to invoke wordpress API from other existing PHP system
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- register_activation_hook on multisite
- WordPress multisite,use same cookies across all website?
- WP: Search and replace in DB programmatically
- How to get current logged-in user details in multisite?
- add_action wp_ajax_ not loading in plugin file WP Network
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- How to share user data across multiple WordPress websites?
- Is there anything special required to make a plugin work in a multisite environment?
- How to edit wp-signup.php content using plugin
- How do I ensure I can loop through every enqueued script and CSS?
- Custom Plugin activation error in Multisite
- Replace “content-area” of themes 404 page with plugin?
- Multisite and the JSON REST API: How to?
- Testing Plugins for Multisite
- Same header/footer in Admin, across all network sites in multisite
- Change Admin menu placement using hooks
- Force remove parent theme CSS/JS and call them from Child theme
- Is There a Plugin Life Cycle Documentation?
- What is an alternative method to the WordPress private _doing_it_wrong() function
- Shortcode adding p and br tags
- Using AJAX in a plugin to submit form – REALLY confused
- Having Problem On Getting WP Post Gallery Images URL
- Can I dynamically create a link to my plugin settings/options page from my plugin description?
- How to load the plugin only when logged in?
- Self-hosted plugin update problems
- Hook into theme-switching later than `setup_theme`
- Save image as featured image
- Best choice of options/settings framework for plugin/theme development
- WP AJAX is not working, always returns 0
- Is it possible to set up multistore in Woocommerce? [closed]
- Admin auto-refresh is interfering with Firebug — how to prevent it?
- Hide plugin dashboard menu item for specific roles
- WordPress mode for emacs?
- Widget translation on my plugin
- Upload to a remote server using wp_remote_post
- Is it possible to change a term slug before being saved to the database?
- How To Change Logout Screen Title
- Replace youtube embed in wordpress
- Admin – Handle data before creating or updating a post, page or custom post
- wp_redirect on base wp-admin and login
- Valid filenames for add_action’s first parameter
- What to hook into to check a value before a post is published?
- How to add a gradient component to a custom block
- wp_schedule_event() set daily, but processed every second
- Can’t get AJAX call working in custom plugin
- Pagination not working with custom wp_query
- wp_insert_user keeps echoing values
- Getting posts by taxonomy
- Exclude Woocommerce Product Category From Sitemap
- How to show only the last two categories in a menu?
- howTo let wordpress endpoint return html-page
- User meta query using Wildcard
- use a (Polymer) web component within a plugin (or theme)?
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Customize WordPress Admin Menu
- Dedicated server and WPDB Class : huge slow-down of the website
- Add Button to TinyMCE Custom Menu
- How should I use wpdb class to submit a form in admin dashboard?
- How do I create Widget within plugin that uses its own class?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- How to design WooCommerce-like admin tabs for plugin settings page?
- Woocommerce: block user removing cart item
- Elementor Top-Bar