Title: wp_parse_id_list
Published: April 25, 2014
Last modified: August 20, 2026

---

# wp_parse_id_list( mixed[]|string $input_list ): int[]

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#parameters)󠁿

 `$input_list`mixed[]|stringrequired

List of IDs.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#return)󠁿

 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.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#source)󠁿

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

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/functions.php#L5065)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/functions.php#L5065-L5069)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_parse_list()](https://developer.wordpress.org/reference/functions/wp_parse_list/)`wp-includes/functions.php` |

Converts a comma- or space-separated list of scalar values to an array.

  |

| Used by | Description | 
| [WP_Privacy_Requests_Table::process_bulk_action()](https://developer.wordpress.org/reference/classes/wp_privacy_requests_table/process_bulk_action/)`wp-admin/includes/class-wp-privacy-requests-table.php` |

Process bulk actions.

  | 
| [WP_Widget_Media_Gallery::has_content()](https://developer.wordpress.org/reference/classes/wp_widget_media_gallery/has_content/)`wp-includes/widgets/class-wp-widget-media-gallery.php` |

Whether the widget has content to show.

  | 
| [WP_Customize_Nav_Menus::sanitize_nav_menus_created_posts()](https://developer.wordpress.org/reference/classes/wp_customize_nav_menus/sanitize_nav_menus_created_posts/)`wp-includes/class-wp-customize-nav-menus.php` |

Sanitizes post IDs for posts created for nav menu items to be published.

  | 
| [WP_Term_Query::get_terms()](https://developer.wordpress.org/reference/classes/wp_term_query/get_terms/)`wp-includes/class-wp-term-query.php` |

Retrieves the query results.

  | 
| [WP_Term_Query::parse_orderby()](https://developer.wordpress.org/reference/classes/wp_term_query/parse_orderby/)`wp-includes/class-wp-term-query.php` |

Parse and sanitize ‘orderby’ keys passed to the term query.

  | 
| [WP_Network_Query::get_network_ids()](https://developer.wordpress.org/reference/classes/wp_network_query/get_network_ids/)`wp-includes/class-wp-network-query.php` |

Used internally to get a list of network IDs matching the query vars.

  | 
| [WP_Site_Query::get_site_ids()](https://developer.wordpress.org/reference/classes/wp_site_query/get_site_ids/)`wp-includes/class-wp-site-query.php` |

Used internally to get a list of site IDs matching the query vars.

  | 
| [WP_Comment_Query::get_comment_ids()](https://developer.wordpress.org/reference/classes/wp_comment_query/get_comment_ids/)`wp-includes/class-wp-comment-query.php` |

Used internally to get a list of comment IDs matching the query vars.

  | 
| [WP_User_Query::parse_orderby()](https://developer.wordpress.org/reference/classes/wp_user_query/parse_orderby/)`wp-includes/class-wp-user-query.php` |

Parses and sanitizes ‘orderby’ keys passed to the user query.

  | 
| [wp_list_categories()](https://developer.wordpress.org/reference/functions/wp_list_categories/)`wp-includes/category-template.php` |

Displays or retrieves the HTML list of categories.

  | 
| [WP_Query::get_posts()](https://developer.wordpress.org/reference/classes/wp_query/get_posts/)`wp-includes/class-wp-query.php` |

Retrieves an array of posts based on query variables.

  | 
| [WP_Tax_Query::clean_query()](https://developer.wordpress.org/reference/classes/wp_tax_query/clean_query/)`wp-includes/class-wp-tax-query.php` |

Validates a single query.

  | 
| [WP_Tax_Query::transform_query()](https://developer.wordpress.org/reference/classes/wp_tax_query/transform_query/)`wp-includes/class-wp-tax-query.php` |

Transforms a single query, from one field to another.

  | 
| [WP_User_Query::prepare_query()](https://developer.wordpress.org/reference/classes/wp_user_query/prepare_query/)`wp-includes/class-wp-user-query.php` |

Prepares the query variables.

  | 
| [get_pages()](https://developer.wordpress.org/reference/functions/get_pages/)`wp-includes/post.php` |

Retrieves an array of pages (or hierarchical post type items).

  | 
| [get_posts()](https://developer.wordpress.org/reference/functions/get_posts/)`wp-includes/post.php` |

Retrieves an array of the latest posts, or posts matching the given criteria.

  | 
| [get_bookmarks()](https://developer.wordpress.org/reference/functions/get_bookmarks/)`wp-includes/bookmark.php` |

Retrieves the list of bookmarks.

  |

[Show 12 more](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_parse_id_list/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Refactored to use [wp_parse_list()](https://developer.wordpress.org/reference/functions/wp_parse_list/) . | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_parse_id_list%2F)
before being able to contribute a note or feedback.