acf_merge_atts()
acf_merge_atts
description
No Hooks.
Returns
$post_id. (int)
Usage
acf_merge_atts( $atts, $extra );
- $atts(required)
- .
- $extra
- .
Default:array()
Changelog
| Since 5.0.9 | Introduced. |
acf_merge_atts() acf merge atts code ACF 6.8.8
function acf_merge_atts( $atts, $extra = array() ) {
// bail early if no $extra
if ( empty( $extra ) ) {
return $atts;
}
// trim
$extra = array_map( 'trim', $extra );
$extra = array_filter( $extra );
// merge in new atts
foreach ( $extra as $k => $v ) {
// append
if ( $k == 'class' || $k == 'style' ) {
$atts[ $k ] .= ' ' . $v;
// merge
} else {
$atts[ $k ] = $v;
}
}
return $atts;
}