WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/21/2017 03:14:52 AM (6 months ago)
Author:
boonebgorges
Message:

Introduce meta_box_sanitize_cb taxonomy argument.

The meta_box_cb argument was introduced in [25572] to allow plugin
authors to provide a custom callback for rendering their taxonomy's meta
box on the post edit screen. However, the routine used to handle the saving
of these custom taxonomy meta boxes was not customizable, but was instead
based simply on whether the taxonomy was hierarchicaly. See [13535].

The new meta_box_sanitize_cb argument defaults to the "tag" routine for
non-hierarchical taxonomies and the "category" routine for hierarchical ones,
thereby maintaining the current default behavior. Developers can override this
when the data passed from their meta_box_cb differs.

Props boonebgorges, ZaneMatthew, stephenharris.
Fixes #36514.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r41987 r42211  
    298298 * @since 4.7.0 Introduced `show_in_rest`, 'rest_base' and 'rest_controller_class'
    299299 *              arguments to register the Taxonomy in REST API.
     300 * @since 5.0.0 Introduced `meta_box_sanitize_cb` argument.
    300301 *
    301302 * @global array $wp_taxonomies Registered taxonomies.
     
    340341 *                                                post_tags_meta_box() is used for non-hierarchical. If false, no meta
    341342 *                                                box is shown.
     343 *     @type callable      $meta_box_sanitize_cb  Callback function for sanitizing taxonomy data saved from a meta
     344 *                                                box. If no callback is defined, an appropriate one is determined
     345 *                                                based on the value of `$meta_box_cb`.
    342346 *     @type array         $capabilities {
    343347 *         Array of capabilities for this taxonomy.
Note: See TracChangeset for help on using the changeset viewer.