WordPress at a glance

wp_parse_list() WP 1.0

Cleans up an array, comma- or space-separated list of scalar values.

Возвращает

Array. Sanitized array of values.

Использование

wp_parse_list( $list );
$list(array/string) (required)
List of values.

Changelog

Since 5.1.0 Introduced.

Код wp_parse_list() WP 5.5.1

<?php
function wp_parse_list( $list ) {
	if ( ! is_array( $list ) ) {
		return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
	}

	return $list;
}

From category: Helper Functions

No comments
    Log In . Register