Password reset message – change the network_home_url( ‘/’ )

Let’s check the Codex and follow the links to the source:

3029    function network_home_url( $path="", $scheme = null ) {
3030            if ( ! is_multisite() )
3031                    return home_url($path, $scheme);
3032    
3033            $current_site = get_current_site();
3034            $orig_scheme = $scheme;
3035    
3036            if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
3037                    $scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
3038    
3039            if ( 'relative' == $scheme )
3040                    $url = $current_site->path;
3041            else
3042                    $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
3043    
3044            if ( $path && is_string( $path ) )
3045                    $url .= ltrim( $path, "https://wordpress.stackexchange.com/" );
3046    
3047            /**
3048             * Filter the network home URL.
3049             *
3050             * @since 3.0.0
3051             *
3052             * @param string      $url         The complete network home URL including scheme and path.
3053             * @param string      $path        Path relative to the network home URL. Blank string
3054             *                                 if no path is specified.
3055        https://core.trac.wordpress.org/browser/tags/4.3.1/src/wp-includes/link-template.php#L3029     * @param string|null $orig_scheme Scheme to give the URL context. Accepts 'http', https://core.trac.wordpress.org/browser/tags/4.3.1/src/wp-includes/link-template.php#L3029'https',
3056             *                                 'relative' or null.
3057             */
3058            return apply_filters( 'network_home_url', $url, $path, $orig_scheme);
3059    }

We see that, yes, there is a filter called network_home_url that we can use to alter the link. A simple filter such as the following would do it, though I doubt you want something this simplified in practice:

function alter_net_link_wpse_206603($url, $path, $orig_scheme) {
  return 'http://myexample.com/member';
}
add_filter('network_home_url','alter_net_link_wpse_206603',10,3);

Leave a Comment