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;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.