WordPress 5.1 will feature a new parameter for
'meta_box_sanitize_cb', which increases flexibility when using core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. UI User interface for custom taxonomies.
Custom taxonomies can specify which metabox A post metabox is a draggable box shown on the post editing screen. Its purpose is to allow the user to select or enter information in addition to the main post content. This information should be related to the post in some way. UI they’d like to use in the Classic Editor by providing a
meta_box_cb parameter when registering their taxonomies. This meant, for example, that a hierarchical taxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies. can choose to use the
post_tags_meta_box() UI instead of
post_categories_meta_box(), which is the default. Prior to 5.1, this customization wasn’t fully functional; while the UI could be swapped out in this way, the data submitted when saving posts was always processed according to whether the taxonomy was registered as hierarchical. This led to scenarios where custom taxonomy values weren’t properly parsed when saving a post.
In 5.1, this behavior is changed in the following ways:
- The POST controller logic that was previously hardcoded in
edit_post() has been abstracted into the new
- WP will try to select an appropriate
_sanitize_ callback based on the
meta_box_cbassociated with the taxonomy. This will fix the underlying bug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. for existing taxonomies.
- Developers who need more control over the processing of their metabox data can provide a custom
meta_box_sanitize_cb when registering their taxonomies.
For more information, see #36514 and .