WordPress at Your Fingertips

wp_parse_id_list() WP 1.0

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

1 time — 0.000044 sec (very fast) | 50000 times — 0.53 sec (very fast)

No Hooks.

Return

Int[]. Sanitized array of IDs.

Usage

wp_parse_id_list( $list );
$list(array|string) (required)
List of IDs.

Changelog

Since 3.0.0 Introduced.
Since 5.1.0 Refactored to use wp_parse_list().

Code of wp_parse_id_list() WP 5.8.1

function wp_parse_id_list( $list ) {
	$list = wp_parse_list( $list );

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

Helper Functions

No comments
    Log In