[wp-trac] [WordPress Trac] #15005: Network theme assets are not efficiently cached

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 1 07:14:32 UTC 2010


#15005: Network theme assets are not efficiently cached
--------------------------+-------------------------------------------------
 Reporter:  berniecode    |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Multisite     |     Version:  3.0.1          
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 In Wordpress 3, when you install a theme and activate it as a network
 theme, all sites share one set of theme files on disk. However, each site
 accesses the files through a different URL.

 For example, if you have two sites, sitea and siteb, using a subfolder
 install and both using the theme "my-theme", the theme files will be
 accessed through:

 {{{
 http://example.com/sitea/wp-content/themes/my-theme/style.css
 and
 http ://example.com/siteb/wp-content/themes/my-theme/style.css
 }}}

 Both these URLs point to the same file through URL rewriting, but the
 browser loads and caches them each separately so when navigating between
 sites, the assets loaded on one site are not reused from the cache for the
 next site.

 The correct behaviour would be for each site to have a stylesheet loaded
 from

 {{{
 http://example.com/wp-content/themes/my-theme/style.css
 }}}

 Workaround:

 I have fixed this issue on my own site with a filter:

 {{{
 add_filter('theme_root_uri', 'alter_theme_root_uri');
 function alter_theme_root_uri($theme_root_uri) {
     // replace
     //     http://example.com/sitename/wp-content/themes
     // with
     //     http://example.com/wp-content/themes
     return preg_replace('#/[\w-]+/(wp-content/themes)#', '/\1',
 $theme_root_uri);
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15005>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list