feat: Customize ACF Flexible Content settings modal field to only show layout field groups
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user