wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_parse_id_list › WordPress Function

Depuis3.0.0
Dépréciéen/a
› wp_parse_id_list ( $input_list )
Paramètres:
  • (array|string|int) $input_list List of IDs.
    Requis: Oui
Retourne:
  • (int[]) Sanitized array of IDs. May include zero. Keys are preserved
    from the input and `array_unique()` may leave gaps, so the
    result is not necessarily a list.
Défini(e) dans:
Codex:
Changelog:
  • 5.1.0
  • 7.2.0

Cleans up an array, comma- or space-separated list of IDs.



Source

function wp_parse_id_list( $input_list ): array {
	$input_list = wp_parse_list( $input_list );

	return array_unique( array_map( 'absint', $input_list ) );
}