A WordPress-centric search engine for devs and theme authors



_wp_add_global_attributes ›

Since3.5.0
Deprecatedn/a
_wp_add_global_attributes ( $value )
Access:
  • private
Parameters:
  • (array) $value An array of attributes.
    Required: Yes
Returns:
  • (array) The array of attributes with global attributes added.
Defined at:
Codex:

Helper function to add global attributes to a tag in the allowed html list.



Source

function _wp_add_global_attributes( $value ) {
	$global_attributes = array(
		'class' => true,
		'id'    => true,
		'style' => true,
		'title' => true,
		'role'  => true,
	);

	if ( true === $value ) {
		$value = array();
	}

	if ( is_array( $value ) ) {
		return array_merge( $value, $global_attributes );
	}

	return $value;
}