wp_parse_slug_list

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

Description

(array) wp_parse_slug_list( (array|string) $list ); 

Returns (array)

Sanitized array of slugs.

Parameters (1)

0. $list (array|string)
List of slugs.

Usage

  1. if ( !function_exists( 'wp_parse_slug_list' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // List of slugs. 
  5. $list = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_parse_slug_list($list); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function wp_parse_slug_list( $list ) { 
  2. if ( ! is_array( $list ) ) { 
  3. $list = preg_split( '/[\s, ]+/', $list ); 
  4.  
  5. foreach ( $list as $key => $value ) { 
  6. $list[ $key ] = sanitize_title( $value ); 
  7.  
  8. return array_unique( $list );