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
- Memory growth with new additions to WordPress Multisite
- What is the correct way to map multiple domains in a WordPress 4.1 multisite install?
- Where can I find documentation on what characters are allowed in user names and why?
- How Can I Centralize Content Usage and Approval in a WordPress Multi-Site installation
- Domain mapping (without plugin) in 4.5.x multisite?
- WordPress Multisite, NGINX and WordPress Subdirectory Install
- get_user_meta() to Return User Meta Only for Current Blog in Multi Site
- Best way to develop multisite and deploy on another server?
- Different back-end colour scheme for the different sites of a multisite
- Removing My Sites menu from Admin
- Theoretical Multi-Server WordPress Setup with Shared Users
- Is there a wordpress function to cleanly delete an entry in the signups table?
- Multisite with path, how to change the main site
- Multisite configuration fails with css/js files
- Broken image multisite
- Multisite – Redirect All Users to Subsite Home Page on Subsite Login
- WPMU Hook for archive or deactivate blog?
- 500 error when using virtual host
- Send email to user that his post has been rejected
- Replacing the default content created while the site creation
- Multisite, can’t see sub blogs
- Google Docs Viewer have problem in MultiSite sub-blogs
- upgrade from WPMU 2.9.2 to WP 3.2.1
- How to create a network using a command line script?
- How to list WP multisite languages
- Syncing content in Multisite. Possible?
- Query to import data from one MultiSite table to another (pages/sub-pages)
- How to fix blocked cookies error that doesn’t let me log into wp-admin?
- Will changing the folder name two directories above a fresh wordpress installation break the site?
- Multisite -> XMLRPC
- FromName –> ReplyTo Name wordpress multisite contact form
- Using WordPress multisite is there a way to force HTTPS on specific subsites and not others?