Uses
Uses | Description |
---|---|
wp-includes/functions.php: is_serialized() | Check value to find if it was serialized. |
Serialize data, if needed.
(string|array|object) (Required) Data that might be serialized.
(mixed) A scalar data.
if( !is_serialized( $data ) ) { $data = maybe_serialize($data); }
File: wp-includes/functions.php
function maybe_serialize( $data ) { if ( is_array( $data ) || is_object( $data ) ) { return serialize( $data ); } /* * Double serialization is required for backward compatibility. * See https://core.trac.wordpress.org/ticket/12930 * Also the world will end. See WP 3.6.1. */ if ( is_serialized( $data, false ) ) { return serialize( $data ); } return $data; }
Version | Description |
---|---|
2.0.5 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/maybe_serialize