Function: sanitize_user_object

sanitize_user_object( object | array $user, string $context )

Sanitize every user field.

If the context is 'raw', then the user object or array will get minimal santization of the int fields.


Name Type(s) Default Value Description
$user object | array

The User Object or Array

$context string 'display'

Optional, default is 'display'. How to sanitize user fields.


object | array

The now sanitized User Object or Array (will be the same type as $user)

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.