acf_field_flexible_content::delete_field
delete_field
description
Method of the class: acf_field_flexible_content{}
No Hooks.
Returns
$post_id. (int)
Usage
$acf_field_flexible_content = new acf_field_flexible_content(); $acf_field_flexible_content->delete_field( $field );
- $field(required)
- .
Changelog
| Since 5.0.0 | Introduced. |
acf_field_flexible_content::delete_field() acf field flexible content::delete field code ACF 6.0.4
function delete_field( $field ) {
if ( ! empty( $field['layouts'] ) ) {
// loop through layouts
foreach ( $field['layouts'] as $layout ) {
// loop through sub fields
if ( ! empty( $layout['sub_fields'] ) ) {
foreach ( $layout['sub_fields'] as $sub_field ) {
acf_delete_field( $sub_field['ID'] );
}
// foreach
}
// if
}
// foreach
}
// if
}