bp_rest_sanitize_string_list( array|string $list )

Clean up an array, comma- or space-separated list of strings.


Parameters Parameters

$list

(array|string) (Required) List of strings.


Top ↑

Return Return

(array) Sanitized array of strings.


Source Source

File: bp-core/bp-core-rest-api.php

function bp_rest_sanitize_string_list( $list ) {
	if ( ! is_array( $list ) ) {
		$list = preg_split( '/[\s,]+/', $list );
	}

	return array_unique( array_map( 'sanitize_text_field', $list ) );
}

Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.