feat: Customize ACF Flexible Content settings modal field to only show layout field groups

This commit is contained in:
2026-03-30 08:38:13 -04:00
parent d47c518565
commit 8aee01340f

View File

@@ -13,3 +13,21 @@ function headless_acf_init() {
acf_update_setting( 'acfe/modules/taxonomies', false );
acf_update_setting( 'acfe/modules/templates', false );
}
// Customize ACF Flexible Content settings modal field to only show layout field groups
add_filter( 'acf/prepare_field', 'headless_acfe_flexible_settings_prepare_field', 20 );
function headless_acfe_flexible_settings_prepare_field( $field ) {
if ( ( $field['_name'] ?? '' ) !== 'acfe_flexible_settings' ) {
return $field;
}
$field['choices'] = array_filter(
$field['choices'],
function ( $key ) {
return strpos( $key, 'group_layout_' ) === 0;
},
ARRAY_FILTER_USE_KEY
);
return $field;
}