On this page
wp_parse_id_list( array|string $list ): int[]
Cleans up an array, comma- or space-separated list of IDs.
Parameters
$listarray|string Required-
List of IDs.
Return
int[] Sanitized array of IDs.
Source
File: wp-includes/functions.php. View all references
function wp_parse_id_list( $list ) {
$list = wp_parse_list( $list );
return array_unique( array_map( 'absint', $list ) );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_parse_list() wp-includes/functions.php | Converts a comma- or space-separated list of scalar values to an array. |
Used By
| Used By | Description |
|---|---|
| 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() 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() 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() wp-includes/class-wp-term-query.php | Retrieves the query results. |
| 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() 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() 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() 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() wp-includes/class-wp-user-query.php | Parses and sanitizes ‘orderby’ keys passed to the user query. |
| wp_list_categories() wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| WP_Tax_Query::clean_query() wp-includes/class-wp-tax-query.php | Validates a single query. |
| 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() wp-includes/class-wp-user-query.php | Prepares the query variables. |
| get_pages() wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| get_posts() wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| get_bookmarks() wp-includes/bookmark.php | Retrieves the list of bookmarks. |
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Refactored to use wp_parse_list() . |
| 3.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_parse_id_list