Duplicate domain in menus
-
I am having issue with a mobile theme plugin that seems for some reason to be adding my sites domain in twice to certain icons.
The homepage is okay but all other icons appear with a src value like
src=”//www.mysite.com//www.mysite.com/wp-content/blah/blah/image.jpg”
I have tried posting to the WPTouch forum but had no reply about it. So at the moment I am having to do a replace in the core wp-includes/nav-menu-template.php function so that it looks for duplicate domains and replaces them. It’s not a generic regex as I don’t really need one plus I don’t want to change it (like I will at the moment) with every WP update e.g
$nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); if(preg_match('@src=\"(https?:)?\/\/www\.mysite\.com\/\/www\.mysite\.com@i',$nav_menu)) { $nav_menu = preg_replace("@src=\"(https?:)?\/\/www\.mysite\.com\/\/www\.mysite\.com@i","src=\"//www.mysite.com",$nav_menu); } if ( $args->echo ) echo $nav_menu; else return $nav_menu;
If there is a better way to stop image URLS like
src=”//www.mysite.com//www.mysite.com/wp-content/blah/blah/image.jpg”
to
src=”//www.mysite.com/wp-content/blah/blah/image.jpg”
Then I would like to know thanks!
Rob
- The topic ‘Duplicate domain in menus’ is closed to new replies.