custom blocks no longer working on 7.1
hi all
i am using custom gutenberg/acf blocks and my sites have just updated to 7.1, which seems to be completely messing up the admin editor section
all of our blocks are stuck in the sidebar and preview mode. i've tried changing in our acf_register_block function, supports mode from false to mode true to get the edit/pencil icon, but that doesn't work anymore. The pencil icon is not appearing to allow us to edit the block in the main editor area.
also tried changing block regsitration to use old API
add_action('acf/init', 'init_full_width');
function init_full_width() {
if( function_exists('acf_register_block') ) {
acf_register_block(array(
'name' => 'full-width',
'title' => __('Full Width Section'),
'description' => __('A custom full width block.'),
'render_callback' => 'my_acf_block_render_callback',
'category' => 'formatting',
'icon' => 'schedule',
'mode' => 'edit',
'api_version' => 2,
'acf_block_version' => 2,
'supports' => [
'mode' => true,
],
'keywords' => array( 'full', 'width' ),
));
}
}
any help or suggestions would be greatly appreciated. crisis mode engaged 😅
EDIT: resolved - sorry for the janky ass formatting. resolved by below. must specify API version
add_action('acf/init', 'init_full_width');
function init_full_width() {
if (!function_exists('acf_register_block_type')) { return; } acf_register_block_type([ 'name' => 'full-width', 'title' => __('Full Width Section'), 'description' => __('A custom full width block.'), 'render_callback' => 'my_acf_block_render_callback', 'category' => 'formatting', 'icon' => 'schedule', 'keywords' => array( 'full', 'width' ), // Required for WordPress 7.1 compatibility. 'api_version' => 3, 'acf_block_version' => 3, ]); }
[link] [comments]