Title: is_serialized_string
Published: April 25, 2014
Last modified: February 24, 2026

---

# is_serialized_string( string $data ): bool

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#wp--skip-link--target)

Checks whether serialized data is of string type.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#parameters)󠁿

 `$data`stringrequired

Serialized data.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#return)󠁿

 bool False if not a serialized string, true if it is.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#source)󠁿

    ```php
    function is_serialized_string( $data ) {
    	// if it isn't a string, it isn't a serialized string.
    	if ( ! is_string( $data ) ) {
    		return false;
    	}
    	$data = trim( $data );
    	if ( strlen( $data ) < 4 ) {
    		return false;
    	} elseif ( ':' !== $data[1] ) {
    		return false;
    	} elseif ( ! str_ends_with( $data, ';' ) ) {
    		return false;
    	} elseif ( 's' !== $data[0] ) {
    		return false;
    	} elseif ( '"' !== substr( $data, -2, 1 ) ) {
    		return false;
    	} else {
    		return true;
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/functions.php#L741)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/functions.php#L741-L760)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#related)󠁿

| Used by | Description | 
| [_list_meta_row()](https://developer.wordpress.org/reference/functions/_list_meta_row/)`wp-admin/includes/template.php` |

Outputs a single row of public meta data in the Custom Fields meta box.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/is_serialized_string/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.0.5](https://developer.wordpress.org/reference/since/2.0.5/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fis_serialized_string%2F)
before being able to contribute a note or feedback.