The obvious problem is that you are trusting user input (http headers) which makes your code suspicious from security POV.
Other then that, no real problems with it, but my experience is that such hacks have a tendency to just move whatever problem you are trying to solve this way to another place.
Related Posts:
- Does WordPress MultiSite use separate MySql databases?
- Multisite Network menu links not updating
- ERR_TOO_MANY_REDIRECTS when i config my subdomains
- Problem with new Multisite Installation
- Domain not redirected correctly with WordPress Multisite
- Update siteurl and home in multisite subsites to https
- Multisite subdirectory blogs missing slash
- Unable to change blog language in multisite
- Site Redirecting to wp-signup.php
- Moving a WP Multisite to a subdirectory
- How to add Custom Blog Options to new blog setup form?
- Switching MultiSite installation from HTTP to HTTPS
- Add additional Network constants to wp-config.php dynamically
- Multisite Network Port Num Issues?
- Why is WordPress Multisite redirecting to wp-signup.php and how to fix it?
- Plugin for editing options on multisite?
- How do I change the Multisite URL?
- multisite 404 error for subdirectory
- How do I transition multiple installations to a single Multisite installation?
- WordPress Multisite with multiple domains using Nginx
- differences between behavior get_option vs get_site_option in multisite
- WP-Admin not working properly at WordPress multisite with subdirectories
- How to individually set WP_DEBUG on a sub-directory multisite?
- WP-CLI methods for get_current_blog_id, get_blog_details or $wpdb->prefix
- COOKIE_DOMAIN setting confusion
- How To Provide Sub-Blogs Their Own Domain Names?
- domain mapping confused about sunrise
- Is there a way to define wp_blogs domains in wp-config?
- Multisite: How to store global options vs. site options?
- Ban SiteNames Multisite
- Multisite behind Varnish
- How do I share plugin settings across WordPress network?
- Blog Settings import/export in WordPress Network environment
- Generate WP-CLI @alias for each site on multisite
- WordPress multisite subdirectory redirect infinite loop issue
- Override Current Theme Setting in wp_config.php
- How to make WordPress use new Upload Path settings in Multisite Setup
- Add site options UI in Multisite Sites > Infos page
- What is the correct form action URL for network options pages?
- Using WP CLI to set options in WP Multisite
- Multisite with path, how to change the main site
- Add New Sub Site from the WordPress back end then in sub site options table option_value must be with https
- Suppress subdirectory from WordPress Multisite primary URL
- Broken image multisite
- (How) Can I change my Multisite Network to use a different blog as Primary?
- How to move theme directory but not plugins/uploads out of WordPress root directory?
- Hide root site in Multisite install
- How to update_site_option for specific site within network?
- Subdomain and subdirectories together in one installation
- how do I configure nginx for wordpress multisite, it occurs ERR_TOO_MANY_REDIRECTS
- WordPress (+WPMU) Import/Export ALL settings?
- Alias domain to Multi-site installation in Apache
- multisite custom directory
- Putting my site live
- What are Attributes used for in a WordPress Multisite?
- How to get option values set from all sites within a Multisite setup?
- How to disable the default WordPress redirect to non-www URLs?
- Bulk theme settings in wordpress multisite
- How to set “Site Address (URL)” programmatically on WP multisite?
- WordPress with Lan and Wan Access?
- What is the function to get options of the parent site of a multisite network?
- Multisite on localhost using xampp
- Error uploading files bigger than 58 MB
- WordPress Network admin options page: how to store options and where will they be stored?
- Use external database with local multisite
- How to fix blocked cookies error that doesn’t let me log into wp-admin?
- WordPress Multi-Site on Ubuntu 18.04 LAMP Keeps Re-Directing
- How to move 1 WP site from a mult-site environment to a different multi-site area
- Multisite with different domain names on different servers
- WordPress rewrite multisite blog url
- Will changing the folder name two directories above a fresh wordpress installation break the site?
- Register submenu on network menu from the subsite
- What are good approaches to routing some urls to a second WordPress install?
- WordPress: how to change URL for individual MultiSites?
- Multisite Create Site not working
- Why is MySQL receiving such a large serialized object?
- How can I remove the folder from a Multisite URL?
- Custom port problem with local MU installation
- Redirect to another page using contact form 7? [closed]
- How do you update a network option value in the DB via a hook
- MULTISITE SUB-DOMAIN JUST SHOWS INDEX OF -> CGI-BIN INSTEAD OF SHOWING SITE
- Multisite Sub domains not working
- Can’t access Dashboard of a Multisite WordPress. Chrome results in “ERR_TOO_MANY_REDIRECTS”
- How do I get the site url from a Block (within the block editor)
- Update blog option during create new blog?
- Include www prefix in site URL
- 403 forbidden when changing settings on WP Multisite non-main sites
- Multisite on single wordpress
- If statement in wp-config.php, is it possible?
- Cannot access WordPress website from external IP while internally it is working properly [closed]
- Update WP install to WP network & it broke the DB connection
- Site Address and WordPress Address settings when using a load balancer
- How to modify wp_config file for set up subdirectory?
- Changing from localhost:8888 to localhost
- Certain lines added to our wp-config.php file are being removed, every day
- get_site_option / update_site_option – the main site and sub sites do not share the same storage
- Interchanging WordPress Multisite primary site
- Multisite Equivalent of `register_setting`?
- wp option get blogname –url=my-sub-site.com returning main site option
- Add www to the Root Site in WP Multisite Network