Support

Account

Home Forums Front-end Issues Flexible Content “enable/disable” feature hides follow-up layouts Reply To: Flexible Content “enable/disable” feature hides follow-up layouts

  • Hi oliwa,

    This is a known behavior with the new enable/disable feature that’s affecting several developers. The issue occurs because when ACF processes flexible content layouts, it checks the enabled/disabled state sequentially. Once it encounters a disabled layout, it appears to stop processing or hide subsequent layouts in that flexible content field – even global layouts loaded by post ID.

    Here are two workarounds you can implement immediately:

    Workaround 1: Reorder with Disabled Layouts at Bottom
    The quickest fix is to drag all disabled layouts to the very bottom of your flexible content field. Since ACF processes layouts in order, keeping active layouts at the top ensures your global layouts will render correctly.

    Workaround 2: Custom Filter to Bypass Disabled Check
    Add this to your theme’s functions.php to force all layouts to render regardless of enabled/disabled status:

    php
    add_filter(‘acf/pre_render_fields’, function($fields, $post_id) {
    // Only target flexible content fields
    if (is_array($fields)) {
    foreach ($fields as &$field) {
    if ($field[‘type’] === ‘flexible_content’) {
    // Ensure all layouts are treated as enabled
    if (isset($field[‘layouts’])) {
    foreach ($field[‘layouts’] as &$layout) {
    $layout[‘enabled’] = true;
    }
    }
    }
    }
    }
    return $fields;
    }, 10, 2);
    Workaround 3: Alternative Global Layouts Approach
    Consider using acf/load_field to programmatically add your global layouts instead of the post ID method:

    php
    add_filter(‘acf/load_field/name=your_flexible_content_field’, function($field) {
    // Get your global layouts from CPT
    $global_layouts = get_posts(array(
    ‘post_type’ => ‘global_layouts’,
    ‘posts_per_page’ => -1
    ));

    foreach ($global_layouts as $layout_post) {
    // Add each global layout programmatically
    $field[‘layouts’][$layout_post->post_name] = array(
    ‘key’ => ‘layout_’ . $layout_post->post_name,
    ‘name’ => $layout_post->post_name,
    ‘label’ => $layout_post->post_title,
    ‘display’ => ‘block’,
    ‘enabled’ => true // Force enabled
    );
    }

    return $field;
    });
    The core issue seems to be that the enabled/disable feature doesn’t properly handle mixed content (local layouts + global post ID layouts). I’d recommend reporting this to the ACF support team as a bug, as this definitely shouldn’t be the expected behavior.

    In the meantime, Workaround 1 is your safest bet for immediate results. The filter approach (Workaround 2) is more comprehensive but test thoroughly on a staging site first.

    Hope this helps you get back on track!