wpseek.com
				A WordPress-centric search engine for devs and theme authors
			maybe_serialize › WordPress Function
Since2.0.5
Deprecatedn/a
› maybe_serialize ( $data )
| Parameters: | 
 | 
| Returns: | 
 | 
| Defined at: | 
 | 
| Codex: | 
Serializes data, if needed.
Related Functions: maybe_unserialize, is_serialized, serialize_block, image_resize, serialize_blocks
	Source
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;
}