Support

Account

Home Forums Gutenberg Force Custom Block Position Reply To: Force Custom Block Position

  • You can force an ACF custom block to show each new Page that is created by setting up a Gutenberg template that includes the block you’d like, with this code:

    function pages_guten_template() {
        $post_type_object = get_post_type_object( 'page' );
        $post_type_object->template = array(
            array( 'acf/custom-block-name' ),
        );
    }
    add_action( 'init', 'pages_guten_template' );

    More details on templates can be found here (including how to lock it in place, if you so desire).