Support

Account

Home Forums ACF PRO render_block() filter in site editor

Unread

render_block() filter in site editor

  • Hello guys,

    When I try to use ACF blocks within a FSE template (e.g. index.html) inside the Site Editor I face several challenges. One of the challenge is that filters like render_blokc() do not seem to work as if I were using them on a (block) page.

    The following filter works perfectly fine for blocks inside a normal “page/post” but not when rendered in the Site editor:

    
    function add_block_placeholder($block_content, $block) {
        // Check if the block data is empty or null
        if ( ! $block['attrs']['data'] ) {
            return 'This is a placeholder text';
        }
        	return $block_content;
        }
    add_filter('render_block', 'add_block_placeholder', 10, 2);
    

    When inspecting the $block object from within the Site Editor, it contains no ACF block at all. Am I missing something?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.