wp_parse_id_list

The timeline below displays how wordpress function wp_parse_id_list has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Cleans up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 * @since 5.1.0 Refactored to use wp_parse_list().
 *
 * @param array|string $input_list List of IDs.
 * @return int[] Sanitized array of IDs.
 */
function wp_parse_id_list($input_list)
{
    $input_list = wp_parse_list($input_list);
    return array_unique(array_map('absint', $input_list));
}

WordPress Version: 5.8

/**
 * Cleans up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 * @since 5.1.0 Refactored to use wp_parse_list().
 *
 * @param array|string $list List of IDs.
 * @return int[] Sanitized array of IDs.
 */
function wp_parse_id_list($list)
{
    $list = wp_parse_list($list);
    return array_unique(array_map('absint', $list));
}

WordPress Version: 5.7

/**
 * Cleans up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 *
 * @param array|string $list List of IDs.
 * @return int[] Sanitized array of IDs.
 */
function wp_parse_id_list($list)
{
    $list = wp_parse_list($list);
    return array_unique(array_map('absint', $list));
}

WordPress Version: 5.5

/**
 * Clean up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 *
 * @param array|string $list List of IDs.
 * @return int[] Sanitized array of IDs.
 */
function wp_parse_id_list($list)
{
    $list = wp_parse_list($list);
    return array_unique(array_map('absint', $list));
}

WordPress Version: 5.4

/**
 * Clean up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 *
 * @param array|string $list List of ids.
 * @return int[] Sanitized array of IDs.
 */
function wp_parse_id_list($list)
{
    $list = wp_parse_list($list);
    return array_unique(array_map('absint', $list));
}

WordPress Version: 5.1

/**
 * Clean up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 *
 * @param array|string $list List of ids.
 * @return array Sanitized array of IDs.
 */
function wp_parse_id_list($list)
{
    $list = wp_parse_list($list);
    return array_unique(array_map('absint', $list));
}

WordPress Version: 4.0

/**
 * Clean up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 *
 * @param array|string $list List of ids.
 * @return array Sanitized array of IDs.
 */
function wp_parse_id_list($list)
{
    if (!is_array($list)) {
        $list = preg_split('/[\s,]+/', $list);
    }
    return array_unique(array_map('absint', $list));
}

WordPress Version: 3.7

/**
 * Clean up an array, comma- or space-separated list of IDs.
 *
 * @since 3.0.0
 *
 * @param array|string $list
 * @return array Sanitized array of IDs
 */
function wp_parse_id_list($list)
{
    if (!is_array($list)) {
        $list = preg_split('/[\s,]+/', $list);
    }
    return array_unique(array_map('absint', $list));
}