Ticket #42253: 42253.2.diff
File 42253.2.diff, 13.7 KB (added by , 5 years ago) |
---|
-
src/wp-includes/class-wp-taxonomy.php
diff --git a/src/wp-includes/class-wp-taxonomy.php b/src/wp-includes/class-wp-taxonomy.php index 123b739b20..c07b07c4b5 100644
a b final class WP_Taxonomy { 237 237 * @since 4.7.0 238 238 * 239 239 * @param array|string $object_type Name of the object type for the taxonomy object. 240 * @param array|string $args Array or query string of arguments for registering a taxonomy. 240 * @param array|string $args { 241 * Array or query string of arguments for registering a taxonomy. 242 * 243 * @type array $labels An array of labels for this taxonomy. By default, Tag labels are 244 * used for non-hierarchical taxonomies, and Category labels are used 245 * for hierarchical taxonomies. See accepted values in 246 * get_taxonomy_labels(). Default empty array. 247 * @type string $description A short descriptive summary of what the taxonomy is for. Default 248 * empty. 249 * @type bool $public Whether a taxonomy is intended for use publicly either via 250 * the admin interface or by front-end users. The default settings 251 * of `$publicly_queryable`, `$show_ui`, and `$show_in_nav_menus` 252 * are inherited from `$public`. 253 * @type bool $publicly_queryable Whether the taxonomy is publicly queryable. 254 * If not set, the default is inherited from `$public` 255 * @type bool $hierarchical Whether the taxonomy is hierarchical. Default false. 256 * @type bool $show_ui Whether to generate and allow a UI for managing terms in this 257 * taxonomy in the admin. If not set, the default is inherited from 258 * `$public` (default true). 259 * @type bool $show_in_menu Whether to show the taxonomy in the admin menu. If true, the 260 * taxonomy is shown as a submenu of the object type menu. If false, 261 * no menu is shown. `$show_ui` must be true. If not set, default is 262 * inherited from `$show_ui` (default true). 263 * @type bool $show_in_nav_menus Makes this taxonomy available for selection in navigation menus. If 264 * not set, the default is inherited from `$public` (default true). 265 * @type bool $show_in_rest Whether to include the taxonomy in the REST API. 266 * @type string $rest_base To change the base url of REST API route. Default is $taxonomy. 267 * @type string $rest_controller_class REST API Controller class name. Default is 268 * 'WP_REST_Terms_Controller'. 269 * @type bool $show_tagcloud Whether to list the taxonomy in the Tag Cloud Widget controls. If 270 * not set, the default is inherited from `$show_ui` (default true). 271 * @type bool $show_in_quick_edit Whether to show the taxonomy in the quick/bulk edit panel. It not 272 * set, the default is inherited from `$show_ui` (default true). 273 * @type bool $show_admin_column Whether to display a column for the taxonomy on its post type 274 * listing screens. Default false. 275 * @type bool|callable $meta_box_cb Provide a callback function for the meta box display. If not set, 276 * post_categories_meta_box() is used for hierarchical taxonomies, and 277 * post_tags_meta_box() is used for non-hierarchical. If false, no meta 278 * box is shown. 279 * @type callable $meta_box_sanitize_cb Callback function for sanitizing taxonomy data saved from a meta 280 * box. If no callback is defined, an appropriate one is determined 281 * based on the value of `$meta_box_cb`. 282 * @type array $capabilities { 283 * Array of capabilities for this taxonomy. 284 * 285 * @type string $manage_terms Default 'manage_categories'. 286 * @type string $edit_terms Default 'manage_categories'. 287 * @type string $delete_terms Default 'manage_categories'. 288 * @type string $assign_terms Default 'edit_posts'. 289 * } 290 * @type bool|array $rewrite { 291 * Triggers the handling of rewrites for this taxonomy. Default true, using $taxonomy as slug. To prevent 292 * rewrite, set to false. To specify rewrite rules, an array can be passed with any of these keys: 293 * 294 * @type string $slug Customize the permastruct slug. Default `$taxonomy` key. 295 * @type bool $with_front Should the permastruct be prepended with WP_Rewrite::$front. Default true. 296 * @type bool $hierarchical Either hierarchical rewrite tag or not. Default false. 297 * @type int $ep_mask Assign an endpoint mask. Default `EP_NONE`. 298 * } 299 * @type string $query_var Sets the query var key for this taxonomy. Default `$taxonomy` key. * If false, a taxonomy cannot be loaded at `?{query_var}={term_slug} 300 * `. If a string, the query `?{query_var}={term_slug}` will be valid. 301 * @type callable $update_count_callback Works much like a hook, in that it will be called when the count is 302 * updated. Default _update_post_term_count() for taxonomies attached 303 * to post types, which confirms that the objects are published before 304 * counting them. Default _update_generic_term_count() for taxonomies 305 * attached to other object types, such as users. 306 * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! 307 * Default false. 308 * } 241 309 */ 242 310 public function set_props( $object_type, $args ) { 243 311 $args = wp_parse_args( $args ); -
src/wp-includes/taxonomy.php
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 293b18b8b6..3046488425 100644
a b function is_taxonomy_hierarchical( $taxonomy ) { 321 321 * 322 322 * @param string $taxonomy Taxonomy key, must not exceed 32 characters. 323 323 * @param array|string $object_type Object type or array of object types with which the taxonomy should be associated. 324 * @param array|string $args { 325 * Optional. Array or query string of arguments for registering a taxonomy. 326 * 327 * @type array $labels An array of labels for this taxonomy. By default, Tag labels are 328 * used for non-hierarchical taxonomies, and Category labels are used 329 * for hierarchical taxonomies. See accepted values in 330 * get_taxonomy_labels(). Default empty array. 331 * @type string $description A short descriptive summary of what the taxonomy is for. Default empty. 332 * @type bool $public Whether a taxonomy is intended for use publicly either via 333 * the admin interface or by front-end users. The default settings 334 * of `$publicly_queryable`, `$show_ui`, and `$show_in_nav_menus` 335 * are inherited from `$public`. 336 * @type bool $publicly_queryable Whether the taxonomy is publicly queryable. 337 * If not set, the default is inherited from `$public` 338 * @type bool $hierarchical Whether the taxonomy is hierarchical. Default false. 339 * @type bool $show_ui Whether to generate and allow a UI for managing terms in this taxonomy in 340 * the admin. If not set, the default is inherited from `$public` 341 * (default true). 342 * @type bool $show_in_menu Whether to show the taxonomy in the admin menu. If true, the taxonomy is 343 * shown as a submenu of the object type menu. If false, no menu is shown. 344 * `$show_ui` must be true. If not set, default is inherited from `$show_ui` 345 * (default true). 346 * @type bool $show_in_nav_menus Makes this taxonomy available for selection in navigation menus. If not 347 * set, the default is inherited from `$public` (default true). 348 * @type bool $show_in_rest Whether to include the taxonomy in the REST API. 349 * @type string $rest_base To change the base url of REST API route. Default is $taxonomy. 350 * @type string $rest_controller_class REST API Controller class name. Default is 'WP_REST_Terms_Controller'. 351 * @type bool $show_tagcloud Whether to list the taxonomy in the Tag Cloud Widget controls. If not set, 352 * the default is inherited from `$show_ui` (default true). 353 * @type bool $show_in_quick_edit Whether to show the taxonomy in the quick/bulk edit panel. It not set, 354 * the default is inherited from `$show_ui` (default true). 355 * @type bool $show_admin_column Whether to display a column for the taxonomy on its post type listing 356 * screens. Default false. 357 * @type bool|callable $meta_box_cb Provide a callback function for the meta box display. If not set, 358 * post_categories_meta_box() is used for hierarchical taxonomies, and 359 * post_tags_meta_box() is used for non-hierarchical. If false, no meta 360 * box is shown. 361 * @type callable $meta_box_sanitize_cb Callback function for sanitizing taxonomy data saved from a meta 362 * box. If no callback is defined, an appropriate one is determined 363 * based on the value of `$meta_box_cb`. 364 * @type array $capabilities { 365 * Array of capabilities for this taxonomy. 366 * 367 * @type string $manage_terms Default 'manage_categories'. 368 * @type string $edit_terms Default 'manage_categories'. 369 * @type string $delete_terms Default 'manage_categories'. 370 * @type string $assign_terms Default 'edit_posts'. 371 * } 372 * @type bool|array $rewrite { 373 * Triggers the handling of rewrites for this taxonomy. Default true, using $taxonomy as slug. To prevent 374 * rewrite, set to false. To specify rewrite rules, an array can be passed with any of these keys: 375 * 376 * @type string $slug Customize the permastruct slug. Default `$taxonomy` key. 377 * @type bool $with_front Should the permastruct be prepended with WP_Rewrite::$front. Default true. 378 * @type bool $hierarchical Either hierarchical rewrite tag or not. Default false. 379 * @type int $ep_mask Assign an endpoint mask. Default `EP_NONE`. 380 * } 381 * @type string $query_var Sets the query var key for this taxonomy. Default `$taxonomy` key. If 382 * false, a taxonomy cannot be loaded at `?{query_var}={term_slug}`. If a 383 * string, the query `?{query_var}={term_slug}` will be valid. 384 * @type callable $update_count_callback Works much like a hook, in that it will be called when the count is 385 * updated. Default _update_post_term_count() for taxonomies attached 386 * to post types, which confirms that the objects are published before 387 * counting them. Default _update_generic_term_count() for taxonomies 388 * attached to other object types, such as users. 389 * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! 390 * Default false. 391 * } 324 * 325 * @see WP_Taxonomy::set_props() 326 * 327 * @param array|string $args Optional. Array or query string of arguments for registering a taxonomy. 328 * Default empty array. 392 329 * @return WP_Error|void WP_Error, if errors. 393 330 */ 394 331 function register_taxonomy( $taxonomy, $object_type, $args = array() ) {