wp_parse_slug_list

The timeline below displays how wordpress function wp_parse_slug_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 slugs.
 *
 * @since 4.7.0
 * @since 5.1.0 Refactored to use wp_parse_list().
 *
 * @param array|string $input_list List of slugs.
 * @return string[] Sanitized array of slugs.
 */
function wp_parse_slug_list($input_list)
{
    $input_list = wp_parse_list($input_list);
    return array_unique(array_map('sanitize_title', $input_list));
}

WordPress Version: 5.8

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

WordPress Version: 5.7

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

WordPress Version: 5.5

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

WordPress Version: 5.4

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

WordPress Version: 5.1

/**
 * Clean up an array, comma- or space-separated list of slugs.
 *
 * @since 4.7.0
 *
 * @param  array|string $list List of slugs.
 * @return array Sanitized array of slugs.
 */
function wp_parse_slug_list($list)
{
    $list = wp_parse_list($list);
    return array_unique(array_map('sanitize_title', $list));
}

WordPress Version: 4.7

/**
 * Clean up an array, comma- or space-separated list of slugs.
 *
 * @since 4.7.0
 *
 * @param  array|string $list List of slugs.
 * @return array Sanitized array of slugs.
 */
function wp_parse_slug_list($list)
{
    if (!is_array($list)) {
        $list = preg_split('/[\s,]+/', $list);
    }
    foreach ($list as $key => $value) {
        $list[$key] = sanitize_title($value);
    }
    return array_unique($list);
}