acf_filter_attrs()
acf_filter_attrs
Filters out empty attrs from the provided array.
Хуков нет.
Возвращает
Массив
.
Использование
acf_filter_attrs( $attrs );
- $attrs(массив) (обязательный)
- The array of attrs.
Список изменений
С версии 5.8.1 | Введена. |
Код acf_filter_attrs() acf filter attrs ACF 6.0.4
function acf_filter_attrs( $attrs ) { // Filter out empty attrs but allow "0" values. $filtered = array_filter( $attrs, 'acf_not_empty' ); // Correct specific attributes (required="required"). foreach ( array( 'required', 'readonly', 'disabled', 'multiple' ) as $key ) { unset( $filtered[ $key ] ); if ( ! empty( $attrs[ $key ] ) ) { $filtered[ $key ] = $key; } } return $filtered; }