I have a strange behaviour.
i work with acf blocks in a lot of my custom themes. suddenly in one of my themes my custom acf blocks do not work anymore correctly.
an basic example block:
acf_register_block_type(
array(
'name' => 'alert',
'title' => __('Alert', JL_TEXTDOMAIN),
'description' => __('A custom Alert block.', JL_TEXTDOMAIN),
'render_template' => 'template-parts/blocks/alert.php',
'category' => 'jl-blocks',
'icon' => 'megaphone',
'keywords' => array( 'alert', 'note' ),
'supports' => array( 'anchor' => true )
)
);
the block is perfectly showing up in the gutenberg backend and also in the frontend BUT ONLY WHEN IM LOGGED IN. if im not logged in i think the_content
filters out the acf blocks
Does no one have the same problem? Blocks perfectly showing when logged in i think it has something to do with $is_preview? the_content() just doesnt apply the blocks. trying to solve it for hours
The post_content in the database shows this:
<!-- wp:acf/alert {"id":"block_6322f7e222bc2","name":"acf/alert","data":{"style":"jd-alert-primary","_style":"field_605a25cbfd38d","content":"test","_content":"field_605a25703f166","animation":"0","_animation":"field_605d359101c4c"},"align":"","mode":"preview"} /-->
<!– wp:paragraph –>
<p>lorem ipsum</p>
<!– /wp:paragraph –>
when im logged in the custom alert block is showing when im not logged in only the <p>lorem ipsum</p> is showing.