Skip to content

Instantly share code, notes, and snippets.

@r-a-y
Created March 4, 2024 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-a-y/bc390ceb5d1872044e05b3aed35431c1 to your computer and use it in GitHub Desktop.
Save r-a-y/bc390ceb5d1872044e05b3aed35431c1 to your computer and use it in GitHub Desktop.
Allow WP MU subdomain redirects
<?php
/**
* Allow subdomain redirects.
*
* WordPress has strict redirect rules and for some reason, does not allow
* subdomain redirects even on the same domain.
*/
add_filter( 'allowed_redirect_hosts', function( $retval, $subdomain ) {
if ( false !== strpos( $subdomain, 'sunygeneseoenglish.org' ) ) {
$retval[] = $subdomain;
}
return $retval;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment