add_action( 'acf/include_fields', function() {
if ( ! function_exists( 'acf_add_local_field_group' ) ) {
return;
}
acf_add_local_field_group( array(
'key' => 'group_6622e9af5e220',
'title' => 'Test Sidebar WYSIWYG',
'fields' => array(
array(
'key' => 'field_6622e9afb3cec',
'label' => 'Test Sidebar WYSIWYG',
'name' => 'test_sidebar_wysiwyg',
'aria-label' => '',
'type' => 'wysiwyg',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'tabs' => 'all',
'toolbar' => 'full',
'media_upload' => 1,
'delay' => 0,
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
),
'menu_order' => 0,
'position' => 'side',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'show_in_rest' => 1,
) );
} );
Describe the bug
When using an ACF WYSIWYG field in a sidebar metabox, the WYSIWYG editor breaks when you switch from the 'Page' tab to the 'Block' tab and back again.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The WYSIWYG should be usable no matter what tabs you switch to. It's not just when I manually switch from 'Page' to 'Block' and then back to 'Page'. When you add a block to a page, the editor will automatically switch the tab for you to 'Block'. Sometimes I'll be messing around with blocks then decide I need to go back to the 'Page' tab and edit my wysiwyg and it's broken.
Code
Version Information:
Additional context
I'm unsure when this broken (update to ACF or WP core) but was definitely recently working, as of at least last major WP version and a few updates of ACF back. This is producible using the WP 2024 theme with no plugins except ACF installed.