A WordPress-centric search engine for devs and theme authors



wp_parse_slug_list ›

Since4.7.0
Deprecatedn/a
wp_parse_slug_list ( $list )
Parameters:
  • (array|string) $list List of slugs.
    Required: Yes
Returns:
  • (array) Sanitized array of slugs.
Defined at:
Codex:

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



Source

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 );
}