A WordPress-centric search engine for devs and theme authors



wp_parse_id_list ›

Since3.0.0
Deprecatedn/a
wp_parse_id_list ( $list )
Parameters:
  • (array|string) $list List of ids.
    Required: Yes
Returns:
  • (array) Sanitized array of IDs.
Defined at:
Codex:

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



Source

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

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