You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is set.
public static setTransientWithUser ( string $transient, mixed $value, integer $expiration, integer $user_id = null ) : boolean | ||
$transient | string | Transient name. Expected to not be SQL-escaped. |
$value | mixed | Transient value. Expected to not be SQL-escaped. |
$expiration | integer | Time until expiration in seconds, default 0 |
$user_id | integer | Optional. User ID. If null the current user id is used instead |
return | boolean | False if value was not set and true if value was set. |