wp_parse_id_list
Clean up an array, comma- or space-separated list of IDs.
Description
(array) wp_parse_id_list( (array|string) $list );
Returns (array)
Sanitized array of IDs.
Parameters (1)
- 0. $list (array|string)
- List of ids.
Usage
if ( !function_exists( 'wp_parse_id_list' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } // List of ids. $list = null; // NOTICE! Understand what this does before running. $result = wp_parse_id_list($list);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/functions.php
- function wp_parse_id_list( $list ) {
- if ( !is_array($list) )
- $list = preg_split('/[\s, ]+/', $list);
- return array_unique(array_map('absint', $list));
- }