{"id":783,"date":"2026-10-20T09:04:22","date_gmt":"2026-10-20T08:04:22","guid":{"rendered":"https:\/\/userswp.io\/documentation\/article\/multisite-subsite-login\/"},"modified":"2026-10-20T09:04:22","modified_gmt":"2026-10-20T08:04:22","slug":"multisite-subsite-login","status":"publish","type":"gd_place","link":"https:\/\/userswp.io\/documentation\/article\/installation\/multisite-subsite-login\/","title":{"rendered":"UsersWP login on subsites of a multisite network"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">How UsersWP behaves on the subsites of a WordPress multisite network depends on how it is activated. Pick the setup that matches where you want users to log in.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The three setups<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Network activated (the default). The UsersWP settings and pages live on the main site only. Login, register and account links on every subsite point to the main site&#8217;s pages, so all logins happen there.<\/li>\n\n\n\n<li>Network activated with pages on one site. Add <code>define( &#039;UWP_ROOT_PAGES&#039;, 2 );<\/code> to wp-config.php, using the ID of the site that should hold the pages. Links on every other site point to that site.<\/li>\n\n\n\n<li>Network activated with pages on all sites. Add <code>define( &#039;UWP_ROOT_PAGES&#039;, &#039;all&#039; );<\/code> to wp-config.php. Each site gets its own UsersWP pages and settings, so users can log in on any subsite.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If UsersWP is activated on single sites instead of network wide, each of those sites has its own pages and settings as well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Users are shared across the network in every setup, because WordPress keeps one user table for all sites. Whether a login on one site carries over to the others depends on your domains and cookie settings in WordPress, not on UsersWP.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Letting users log in on a subsite<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you want people to log in from a subsite and stay there, use the &#8220;pages on all sites&#8221; setup (or per site activation) so each subsite has its own login page. Then set the redirect on each site at UsersWP &gt; General &gt; Login.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the default setup the login form is on the main site. You can still send users back after login by adding <code>redirect_to<\/code> to the login link, but WordPress only follows redirects to its own host. To allow your subdomains, add them with the <code>allowed_redirect_hosts<\/code> filter:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;allowed_redirect_hosts&#039;, &#039;my_allow_network_hosts&#039; );\nfunction my_allow_network_hosts( $hosts ) {\n\tforeach ( get_sites( array( &#039;fields&#039; =&gt; &#039;ids&#039; ) ) as $site_id ) {\n\t\t$hosts&#091;&#093; = wp_parse_url( get_home_url( $site_id ), PHP_URL_HOST );\n\t}\n\treturn array_unique( $hosts );\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Social login providers check the address the user comes back to, so if logins happen on more than one domain, add each domain as an allowed redirect URL in the provider&#8217;s app settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The setup options are covered in more detail in <a href=\"https:\/\/userswp.io\/documentation\/article\/installation\/using-userswp-on-multisite-networks\/\">Using UsersWP on multisite networks<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How UsersWP behaves on the subsites of a WordPress multisite network depends on how it is activated. Pick the setup that matches where you want users to log in. The three setups If UsersWP is activated on single sites instead of network wide, each of those sites has its own pages and settings as well. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[9,3],"class_list":["post-783","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-installation","gd_placecategory-getting-started"],"_links":{"self":[{"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/article\/783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/comments?post=783"}],"version-history":[{"count":0,"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/article\/783\/revisions"}],"wp:attachment":[{"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/media?parent=783"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/article\/tags?post=783"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/userswp.io\/documentation\/wp-json\/wp\/v2\/article\/categories?post=783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}