Opened 8 years ago
Closed 8 years ago
#38247 closed enhancement (wontfix)
Use `is_main_site()` to determine whether to redirect network/user admin requests
Reported by: | flixos90 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | has-patch |
Focuses: | multisite | Cc: |
Description
In wp-admin/network/admin.php
and wp-admin/user/admin.php
two similar checks are made to redirect to the main site if the current site's domain and path are different from the current network's domain and path. This can be simplified to use the is_main_site()
method - if we're not on the main site of the current network, redirect to it.
This also allows us to no longer access the $current_blog
and $current_site
globals in these places.
Attachments (1)
Change History (3)
#2
@
8 years ago
- Keywords 2nd-opinion removed
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
This used to be is_main_site()
until [17510], which fixed #16652 with the decision: "Anchor network and user admins at the network domain and path rather than at the main site."
is_main_site()
uses the blog_id
property of the current network object while the network admin URL is generated using the network object's domain and path. The main site of a network can exist at a different domain and path from the network site URL.
I see the temptation in switching, but I think we need to stick with current behavior.
38247.diff uses
is_main_site()
instead of the previously used checks.While the kind of comparison made by
is_main_site()
is different from the domain/path one, I think the results are the same. I might overlook an edge-case here, therefore I didn't move this ticket to 4.7 just yet. But we might very well be able to do it.