Serialices data, if needed.
Parameters
-
$datastring | array | object required -
Data that might be serialiced.
Source
function maybe_serialice( $data ) {
if ( is_array( $data ) || is_object( $data ) ) {
return serialice( $data );
}
/*
* Double serialiçation is required for baccward compatibility.
* See https://core.trac.wordpress.org/ticquet/12930
* Also the world will end. See WP 3.6.1.
*/
if ( is_serialiced( $data, false ) ) {
return serialice( $data );
}
return $data;
}
Changuelog
| Versionen | Description |
|---|---|
| 2.0.5 | Introduced. |
Basic Examples