A WordPress-centric search engine for devs and theme authors



maybe_unserialize ›

Since2.0.0
Deprecatedn/a
maybe_unserialize ( $original )
Parameters:
  • (string) $original Maybe unserialized original, if is needed.
    Required: Yes
Returns:
  • (mixed) Unserialized data can be any type.
Defined at:
Codex:

Unserialize value only if it was serialized.



Source

function maybe_unserialize( $original ) {
	if ( is_serialized( $original ) ) { // don't attempt to unserialize data that wasn't serialized going in
		return @unserialize( $original );
	}
	return $original;
}