function maybe_serialize( $data ) {}

Serialize data, if needed.


  • mixed $data: Data that might be serialized.

Return values

returns:A scalar data

Source code

function maybe_serialize( $data ) {

	if ( is_array( $data ) || is_object( $data ) )

		return serialize( $data );

	// Double serialization is required for backward compatibility.

	// See

	if ( is_serialized( $data ) )

		return serialize( $data );

	return $data;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: