wc_get_notice_data_attr( array $notice )

Get notice data attribute.


Description Description


Parameters Parameters

$notice

(Required) Notice data.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-notice-functions.php

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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.