Merge pull request #754 from retlehs/external_urls_fix
Only make URLs relative if its not external
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
### 6.4.0: May 1st, 2013
|
||||
* Fix relative external URLs issue
|
||||
* Fix Theme Activation page issues
|
||||
* Fix issues with root relative URLs and rewrites on non-standard setups
|
||||
* Make sure rewrites are added to .htaccess immediately after activation
|
||||
|
||||
@@ -138,8 +138,16 @@ add_filter('body_class', 'roots_body_class');
|
||||
* @author Scott Walkinshaw <scott.walkinshaw@gmail.com>
|
||||
*/
|
||||
function roots_root_relative_url($input) {
|
||||
$output = wp_make_link_relative($input);
|
||||
return $output;
|
||||
$parsed_url = parse_url(site_url());
|
||||
$site_domain = $parsed_url['host'];
|
||||
|
||||
preg_match('|https?://([^/]+)(/.*)|i', $input, $matches);
|
||||
|
||||
if (isset($matches[1]) && isset($matches[2]) && $matches[1] === $site_domain) {
|
||||
return wp_make_link_relative($input);
|
||||
} else {
|
||||
return $input;
|
||||
}
|
||||
}
|
||||
|
||||
function roots_enable_root_relative_urls() {
|
||||
@@ -152,7 +160,7 @@ if (roots_enable_root_relative_urls()) {
|
||||
'the_permalink',
|
||||
'wp_list_pages',
|
||||
'wp_list_categories',
|
||||
'wp_nav_menu',
|
||||
'roots_wp_nav_menu_item',
|
||||
'the_content_more_link',
|
||||
'the_tags',
|
||||
'get_pagenum_link',
|
||||
|
||||
@@ -34,6 +34,7 @@ class Roots_Nav_Walker extends Walker_Nav_Menu {
|
||||
$item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html);
|
||||
}
|
||||
|
||||
$item_html = apply_filters('roots_wp_nav_menu_item', $item_html);
|
||||
$output .= $item_html;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user