絶対パスの記述って好きじゃないので。。
functions.php
/**
* 画像パスの相対化
* @param $url 画像パス
*/
function delete_host_from_attachment_url($url)
{
$regex = '/^http(s)?:\/\/[^\/\s]+(.*)$/';
if(preg_match($regex, $url, $m)){
$url = $m[2];
}
return $url;
}
add_filter('wp_get_attachment_url', 'delete_host_from_attachment_url');