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.


Parameters

$taxonomy

(string)(Required)The taxonomy name.

$terms

(array)(Required)Raw term data from the 'tax_input' field.


Top ↑

Return

(int[]) Array of sanitized term IDs.


Top ↑

Source

File: wp-admin/includes/post.php

function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonomy, $terms ) {
	return array_map( 'intval', $terms );
}

Top ↑

Changelog

Changelog
VersionDescription
5.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More