taxonomy_meta_box_sanitize_cb_checkboxes() WordPress Function
The taxonomy_meta_box_sanitize_cb_checkboxes() function is a custom sanitization callback function for checkboxes sanitization in the taxonomy meta box. This function is necessary because the default WordPress checkboxes sanitization callback function does not work when used with the taxonomy meta box. This function loops through all of the checkboxes in the taxonomy meta box and verifies that they are all valid values. If any of the checkboxes are not valid, then the function returns an error. Otherwise, the function returns thesanitized data.
taxonomy_meta_box_sanitize_cb_checkboxes( string $taxonomy, array $terms ) #
Sanitizes POST values from a checkbox taxonomy metabox.
Contents
Parameters
- $taxonomy
(string)(Required)The taxonomy name.
- $terms
(array)(Required)Raw term data from the 'tax_input' field.
Return
(int[]) Array of sanitized term IDs.
Source
File: wp-admin/includes/post.php
function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonomy, $terms ) { return array_map( 'intval', $terms ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.1.0 | Introduced. |