Support for ACF Blocks
-
Hello
I have a problem with displaying images in the ACF Blocks. According to my tests, plugin works correct. When I’m adding example code on top of page.php file it’s generating correct markup, but when I’m adding code in the ACF Block then markup is striped down.
My example code:<?php
echo bis_get_attachment_picture(
1622,
[
375 => [ 375, 9999, 0, 1585],
412 => [ 412, 9999, 0, 1585 ],
768 => [ 716, 9999, 0, 1585 ],
991 => [ 939, 9999, 0 ],
1199 => [ 1148, 9999, 0 ],
1350 => [ 1298, 9999, 0 ],
1920 => [ 1868, 9999, 0 ]
],
array(
'retina' => true,
'class' => 'w-[300px]')
);
?>Result coming from page.php:
<picture><source media="(max-width:375px)" srcset="http://website-url.local/wp-content/uploads/bis-images/1585/home-hero_mobil-375x9999.jpg 1x, http://website-url.local/wp-content/uploads/bis-images/1585/home-hero_mobil-750x19998.jpg 2x"><source media="(max-width:412px)" srcset="http://website-url.local/wp-content/uploads/bis-images/1585/home-hero_mobil-412x9999.jpg 1x, http://website-url.local/wp-content/uploads/bis-images/1585/home-hero_mobil-824x19998.jpg 2x"><source media="(max-width:768px)" srcset="http://website-url.local/wp-content/uploads/bis-images/1585/home-hero_mobil-716x9999.jpg 1x, http://website-url.local/wp-content/uploads/bis-images/1585/home-hero_mobil-1432x19998.jpg 2x"><source media="(max-width:991px)" srcset="http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-939x9999.jpg 1x, http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-1878x19998.jpg 2x"><source media="(max-width:1199px)" srcset="http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-1148x9999.jpg 1x, http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-2296x19998.jpg 2x"><source media="(max-width:1350px)" srcset="http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-1298x9999.jpg 1x, http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-2596x19998.jpg 2x"><source media="(max-width:1920px)" srcset="http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-1868x9999.jpg 1x, http://website-url.local/wp-content/uploads/bis-images/1622/home-hero_7-3736x19998.jpg 2x"><source media="(min-width:1921px)" srcset="http://website-url.local/wp-content/uploads/2025/07/home-hero_7.jpg"><img width="3273" height="1946" src="http://website-url.local/wp-content/uploads/2025/07/home-hero_7.jpg" class="w-[300px]" alt="" retina="1" decoding="async" fetchpriority="high"></picture>Result coming from ACF Block:
<picture><source media="(max-width:375px)" ><source media="(max-width:412px)" ><source media="(max-width:768px)" ><source media="(max-width:991px)" ><source media="(max-width:1199px)" ><source media="(max-width:1350px)" ><source media="(max-width:1920px)" ><source media="(min-width:1921px)" ><img width="3273" height="1946" src="http://website-url.local/wp-content/uploads/2025/07/home-hero_7.jpg" class="w-[300px]" alt="" decoding="async" fetchpriority="high"></picture>I turned off all the plugins except ACF during the tests. Do you know if there is some filter that can be disabled for this case or any other solution?
AI suggested the following code, but it didn’t help:
function allow_srcset_in_kses($tags, $context) {
$tags['img']['srcset'] = true;
$tags['img']['sizes'] = true;
$tags['source'] = array(
'srcset' => true,
'sizes' => true,
'type' => true,
'media' => true
);
return $tags;
}
add_filter('wp_kses_allowed_html', 'allow_srcset_in_kses', 10, 2);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Support for ACF Blocks’ is closed to new replies.