_wp_add_global_attributes

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

Description

(array) _wp_add_global_attributes( (array) $value ); 

Returns (array)

The array of attributes with global attributes added.

Parameters (1)

0. $value (array)
An array of attributes.

Usage

  1. if ( !function_exists( '_wp_add_global_attributes' ) ) { 
  2. require_once ABSPATH . WPINC . '/kses.php'; 
  3.  
  4. // An array of attributes. 
  5. $value = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _wp_add_global_attributes($value); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/kses.php  
  1. function _wp_add_global_attributes( $value ) { 
  2. $global_attributes = array( 
  3. 'class' => true,  
  4. 'id' => true,  
  5. 'style' => true,  
  6. 'title' => true,  
  7. 'role' => true,  
  8. ); 
  9.  
  10. if ( true === $value ) 
  11. $value = array(); 
  12.  
  13. if ( is_array( $value ) ) 
  14. return array_merge( $value, $global_attributes ); 
  15.  
  16. return $value;