WordPress at a glance

wp_parse_id_list() WP 1.0

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

Works based on: wp_parse_list()
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.

Code of wp_parse_id_list() WP 5.7.2

<?php
function wp_parse_id_list( $list ) {
	$list = wp_parse_list( $list );

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

From category: Helper Functions

No comments
    Log In