-
Notifications
You must be signed in to change notification settings - Fork 1
array_esc_attr
Tonya Mork edited this page Mar 12, 2017
·
1 revision
The array_esc_attr()
function escapes the HTML attributes for each element's string value by passing each one through the WordPress esc_attr
.
Escaping means the following characters are encoded: <
(less than), >
(greater than), &
(ampersand), "
(double quote), and '
(single quote).
You can escape one level of the array, or for deeper arrays, you can set the second argument to true.
array array_esc_attr(
array &$subjectArray,
[ bool $goDeep = false ]
);
Where:
$subjectArray
is the array to work on and contains the subset you want
$goDeep
when true
, this function will escape all string values at each level within the subject array; else, only the first depth level is escaped.
Use this function when you need to clean up an array of attributes before rendering out to the browser or storing in the database.