Ok I have cracked it, by spoofing the $_SERVER variable and pre-defing some constants, I was able to prevent WordPress from redirecting after the inclusion of wp-load.php.
define('WP_USE_THEMES', false);
define( 'DOMAIN_CURRENT_SITE', $siteRow['domain'] );
define( 'PATH_CURRENT_SITE', "https://wordpress.stackexchange.com/" );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', $siteRow['wp_blog_id'] );
$_SERVER = array(
"HTTP_HOST" => $siteRow['domain'],
"SERVER_NAME" => $siteRow['domain'],
"REQUEST_URI" => "https://wordpress.stackexchange.com/",
"REQUEST_METHOD" => "GET"
);
require_once WP_PATH.'wp-load.php';
switch_to_blog($siteRow['wp_blog_id']);
$siteRow contains details about the target site. Note: This cannot be inside a function due to global variable restraints.
Related Posts:
- Create mobile site with same content just different theme
- How to hide or remove unwanted widgets on Multisite installation?
- How can I diagnose a slow WordPress admin?
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- WP-Admin not working properly at WordPress multisite with subdirectories
- Multisite posts in categories on network
- find a random blogid across my multisite network that has at least one post published
- Security in WordPress plugin development
- Hide a theme on list of themes in wp-admin without editing core files
- Difference Between Admin and Super Admin in Database
- wp-admin slow in multisite
- WPDB Multiple site’s posts and get featured images
- Don’t allow access to wp-admin but allow admin-ajax requests to be fulfilled on frontend?
- Timeout While Upgrading Network in Multi-site
- Uploading Images to Multi-Site Causes Failure to HTTP Error
- Multisite wp-admin redirect loop
- WordPress network (multisite) /wp-admin/ redirect loop (ERR_TOO_MANY_REDIRECTS)
- Copy posts from one blog to another in multisite environment
- My subsites accidentally went from one multisite network to another. How do I change it back?
- Redirect loop (only for multisite network admin)
- Manipulate list of themes in wp-admin
- Subsites in Multisite installation throwing 404 error on wp-admin in IIS 7
- How to remove Broken Link Checker widget from admin menu
- Using $wpdb Class to Pull Recent Comments Across a Network
- How to set Active plugins as the default screen?
- Why can’t I delete original user in multisite? Options for manual removal
- Multisite network admin – URL / redirect error
- How to order by blog ID in this multisite ‘List Blogs’ custom function
- Cookie nonce is invalid – Multisite
- WordPress mutisite migration
- Why does the My Site dropdown show only a single domain?
- Bootstrapping WordPress MultiSite Outsite of WordPress – No $wpdb
- Super admin access to a forgotten WP instance?
- Multi-site: removing /blog from posts
- Retrieving multisite blog IDs, somehow failing to foreach them properly
- Network Plugin Creating Pages for Different Subdomains
- Iframe being removed only for some users when publishing a page
- Optimizing Query used for a Shortcode
- WP Multisite with Domain Mapping : Preventing User Access to Dashboard
- Use WordPress MultiSite (WPMS) with a remote database for each created site
- 2 website 1 database… Local to online
- Moving wp-admin folder to a different host in a multisite environment
- How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]
- Site’s admin created with wpmu_create_blog accessible only on 2nd attempt
- Is There A Plugin to Create WP Multisite Installs programatically
- Can’t log in to wp-admin after setting up Multisite
- Check if current site ID and value exist in WPDB
- Multi-site site nav, wpdb->prepare missing argument
- WP MS: How to query over the network
- Infamous admin login redirect
- WordPress multisite second site admin resulting in too many redirects error
- Multisite wp-admin redirecting to main wp-admin using NGINX
- WordPress Multisite: Login to all subsites at once
- How to Add Super Admin for WordPress multi-site
- network admin pages not linked to correctly
- Multisite – cannot remove specific sub-menu its parent menu. All sub-menus disappear
- How to have same admin login for more than one site?
- WP Admin Panel for Multi-site install not loading JavaScript for one Subdomain
- Backend freezing on certain pages of a subsite
- WP DB Location for “Next Post to Create” Index Value
- Admin user getting redirected to /wp-admin/user
- Pages redirect me to the homepage
- Run “get_the_post_thumbnail” with a different table prefix?
- Many big issues in the website, WP_Debug not showing
- What could be changing my WP password and blocking plugins from installing?
- Wp-admin wrongly redirecting on multisite
- Unable to change blog language in multisite
- Multisite logged into one wp-admin, move to another sites wp-admin asked to login again
- Why am I getting the login screen in wp-admin->Appearance->Customize?
- The wp-admin url for each site does not work on WordPress multisite
- Memory growth with new additions to WordPress Multisite
- Complex WordPress Website
- Create default pages in wordpress multisite
- Possibility of Create Site Specific CSS in a Multisite
- How do you update a network option value in the DB via a hook
- Bulk Move Users from one site to another within a network ( Multisite )
- $post not working working in AJAX plugin with custom post type
- How do I create a multi site network?
- How to replace “Password Protected” text with icon in Admin
- FeedWordPress duplicated posts problem
- Hosting 2 WordPress websites in /public_html/ & /public_html/subdirectory/ at the same time
- Migrating Multisite with WP-Cli and/or Search-Replace-DB
- Does a single theme license work on multisite? [closed]
- When creating a multisite, the sub-folders option is not available
- Amazon EC2 and static page Caching (Multisite): How to enable Caching with multiple instances?
- MU domain mapping subdomain multisite : map a subdomain on another subdomain
- MULTISITE SUB-DOMAIN JUST SHOWS INDEX OF -> CGI-BIN INSTEAD OF SHOWING SITE
- Multisite Sub domains not working
- Contact Form 7 in Multisite [closed]
- Can’t access Dashboard of a Multisite WordPress. Chrome results in “ERR_TOO_MANY_REDIRECTS”
- I want to create a 300 multi-site wordpress network using subdomains
- How Can I Change The Name Of My Subdomain in WordPress Multisite
- Network activating; if ( !current_user_can( ‘manage_options’ ) ) locks me out…
- WordPress Multisite – Load users using custom query
- is_main_site() Always Returns True
- Pull Custom /wp-admin/css for Non-Admin in Multisite
- How can I create blog specific database table in multisite?
- WordPress multi-site, developing locally and syncing live changes
- Add access control origin header information across multisite
- Where to set individual blog quotas?