Opened 11 years ago
Last modified 5 years ago
#26985 new enhancement
Use network_site_url in includes_url
Reported by: | nofearinc | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.6 |
Component: | Permalinks | Keywords: | has-patch needs-refresh |
Focuses: | multisite | Cc: |
Description (last modified by )
The includes_url
function is used in several places for getting the path to wp-includes
. For example, class-wp-editor.php
is using it to get the $baseurl
variable and load other related scripts (such as TinyMCE) accordingly.
On a multisite, includes_url
relies on site_url
which leads to a similar path if ran on a subsite in a network:
site.com/subsite/wp-includes/...
If a server like nginx doesn't have a working rewrite for a given version, across the site we could use hooks such as script_loader_src
or style_loader_src
to work around the problem, and we could also filter includes_url
to set the correct paths (as workarounds). I suggest switching to network_site_url
instead as it fallbacks to site_url
for single sites.
Attachments (1)
Change History (9)
#2
@
11 years ago
- Description modified (diff)
- Summary changed from Use network_site_url in includes_dir to Use network_site_url in includes_url
#3
@
11 years ago
Hi @nofearinc, I like this on the surface for multisite with subdirectories. I'm unsure of how it could affect subdomain installs, or a future where subdomain and subdirectory installs are terms of the past.
If a site is loaded on http://site1.network.com
and a CSS file or JS file is used, would it have any troubles loading from http://network.com/wp-includes/js/...
? This could create some interesting HTTP vs HTTPS stuff too.
If a site is loaded on http://uniquesite1.com
and that file is loaded from http://parentnetwork.com
, what troubles would that cause?
#4
@
11 years ago
Hey @jeremyfelt, I've tested that on two different types of multisites and weren't able to break it (I could definitely be missing some cases though). In my opinion if there are issues with specific types of multisites, that would be a problem in network_site_url
that should be revised separately.
#5
@
11 years ago
- Component changed from Networks and Sites to Permalinks
- Type changed from defect (bug) to enhancement
This would cause issues in two cases I can think of in particular:
- Where someone doesn't want this behavior, such as if they are using a multisite not as a cohesive network, but for separate clients.
- Things that are restricted from happening in a cross-domain fashion, like MediaElement and Plupload.
If site_url() and network_site_url() are the same domain, then I could see considering this. Otherwise, go use a CDN :-)
This ticket was mentioned in IRC in #wordpress-dev by nofearinc. View the logs.
11 years ago
#7
@
11 years ago
Thanks nacin, I haven't tested that in an environment with domain mapping configured.
The two things just bothering me are:
- The
$baseurl
set for the wp-editor and then loaded in a few places like this seems a bit tough for me to export to CDN (or generally problematic overall for the admin area) - Isn't
network_site_url
supposed to behave normally anyway? Just curious if it's another vector to consider if being used in other functions for fetching the correct URL (or providing another helper that respects mapped domains)?
replace site_url with network_site_url