wpseek.com
A WordPress-centric search engine for devs and theme authors
sanitize_user_object is deprecated since version 3.3.0!
sanitize_user_object › WordPress Function
Since2.3.0
Deprecated3.3.0
› sanitize_user_object ( $user, $context = 'display' )
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: |
Sanitize every user field.
If the context is 'raw', then the user object or array will get minimal sanitization of the int fields.Related Functions: sanitize_user, sanitize_user_field, rest_sanitize_object, sanitize_url, sanitize_meta
Source
function sanitize_user_object($user, $context = 'display') { _deprecated_function( __FUNCTION__, '3.3.0' ); if ( is_object($user) ) { if ( !isset($user->ID) ) $user->ID = 0; if ( ! ( $user instanceof WP_User ) ) { $vars = get_object_vars($user); foreach ( array_keys($vars) as $field ) { if ( is_string($user->$field) || is_numeric($user->$field) ) $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); } } $user->filter = $context; } else { if ( !isset($user['ID']) ) $user['ID'] = 0; foreach ( array_keys($user) as $field ) $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); $user['filter'] = $context; } return $user; }