wordpressの本番切替時にJSのNotFoundを避ける。

wordpressでhttp://ほげほげ/wordpressとhttp://ほげほげ/を切り替えた際、

JSでエラーが出ないようにする。  

var temp_first_url="http://"+location.host+"/";

if(location.href.indexOf("wordpress"))

     temp_first_url+="wordpress/";

 

あとはいつもの

images/ほげほげ.gif

みたいなリンクに

temp_first_url+'images/ほげほげ.gif'

にしてあげればOK