retlehs/roots — pull request #688 by damianregan (2013-02-21 17:13:29+00:00)
Title: Relative URLs

Small fix for relative URLs where site_url != home_url. Also fixes multiple subdirectory in URL issue (at least in my tests). I have removed the "Terrible Workaround".

Problem was caused by home_url() being stripped early on, then later the site_url being prepended in functions like WP_Styles::_css_href(), before only the home_url was stripped again, missing the subdir. Could maybe be fixed in a cleaner way by simply changing WP core to prevent base_url being prepended to links where no site URL is present, could check for and add content_url instead where appropriate.

E.g. for home url example.com with WordPress install at example.com/wordpress, roots_root_relative_url() would strip example.com, WP_Styles::_css_href() would add example.com/wordpress, and then roots_root_relative_url() would strip example.com again, leaving /wordpress/... at the start of the URL.

Anyway, not sure if this fix applies to all cases, but it works for me and it's nice and simple.

RE: #395, #533, etc.