wc_get_notice_data_attr()
Get notice data attribute.
No Hooks.
Return
String
.
Usage
wc_get_notice_data_attr( $notice );
- $notice(array) (required)
- Notice data.
Changelog
Since 3.9.0 | Introduced. |
wc_get_notice_data_attr() wc get notice data attr code WC 9.4.2
function wc_get_notice_data_attr( $notice ) { if ( empty( $notice['data'] ) ) { return; } $attr = ''; foreach ( $notice['data'] as $key => $value ) { $attr .= sprintf( ' data-%1$s="%2$s"', sanitize_title( $key ), esc_attr( $value ) ); } return $attr; }