wc_implode_html_attributes()WC 3.3.0

Implode and escape HTML attributes for output.

No Hooks.

Return

String.

Usage

wc_implode_html_attributes( $raw_attributes );
$raw_attributes(array) (required)
Attribute name value pairs.

Changelog

Since 3.3.0 Introduced.

wc_implode_html_attributes() code WC 8.7.0

function wc_implode_html_attributes( $raw_attributes ) {
	$attributes = array();
	foreach ( $raw_attributes as $name => $value ) {
		$attributes[] = esc_attr( $name ) . '="' . esc_attr( $value ) . '"';
	}
	return implode( ' ', $attributes );
}