Support

Account

Forum Replies Created

  • I have found a solution to this if anyone is interested.

    When using renderTemplate ACF renders the template and then replaces <InnerBlocks /> with the actual rendered blocks after the fact.

    However, if you use renderCallback instead the second argument of the callback is the fully rendered inner blocks and therefore this would work:

    
    function my_render_callback($block, $content, $is_preview=false) {
      if($is_preview) {
        echo "<InnerBlocks />"; // render JSX in the editor
      }
      else {
        $has_inner_blocks = strnlen($content) > 0;
        if($has_inner_blocks) {
          echo $content; 
        }
    
      }
    
    }
    
Viewing 1 post (of 1 total)