Support

Account

Home Forums Front-end Issues WordPress Multisite – Domain Mapping issue Reply To: WordPress Multisite – Domain Mapping issue

  • Hi @martinrp,

    Im not sure if you have the same issue as me. But I get “sites/0/” in my attachment URLs. If you have the same issue, then use following code in your functions.php.

    add_filter('wp_get_attachment_image_src', 'acf_multisite_upload_fix', 10, 4);
    function acf_multisite_upload_fix($image, $attachment_id, $size, $icon){
    	global $current_blog;
    	if(isset($image[0])){
    		$replace = $current_blog->blog_id > 1 ? 'sites/' . $current_blog->blog_id . '/' : '';
    		$image[0] = str_replace('sites/0/', $replace, $image[0]);	
    	}
    	return $image;
    }