Changeset 34510 for trunk/src/wp-includes/taxonomy-functions.php
- Timestamp:
- 09/24/2015 07:11:53 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/taxonomy-functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy-functions.php
r34446 r34510 261 261 262 262 /** 263 * Create or modify a taxonomy object. Do not use before init. 263 * Creates or modifies a taxonomy object. 264 * 265 * Note: Do not use before the {@see 'init'} hook. 264 266 * 265 267 * A simple function for creating or modifying a taxonomy object based on the … … 268 270 * the object type. 269 271 * 270 * Nothing is returned, so expect error maybe or use taxonomy_exists() to check271 * whether taxonomy exists.272 *273 * Optional $args contents:274 *275 * - label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used.276 * - labels - An array of labels for this taxonomy.277 * * By default tag labels are used for non-hierarchical types and category labels for hierarchical ones.278 * * You can see accepted values in {@link get_taxonomy_labels()}.279 * - description - A short descriptive summary of what the taxonomy is for. Defaults to blank.280 * - public - If the taxonomy should be publicly queryable.281 * * Defaults to true.282 * - hierarchical - Whether the taxonomy is hierarchical (e.g. category). Defaults to false.283 * - show_ui - Whether to generate and allow a UI for managing terms in this taxonomy in the admin.284 * * If not set, the default is inherited from public.285 * - show_in_menu - Whether to show the taxonomy in the admin menu.286 * * If true, the taxonomy is shown as a submenu of the object type menu.287 * * If false, no menu is shown.288 * * show_ui must be true.289 * * If not set, the default is inherited from show_ui.290 * - show_in_nav_menus - Makes this taxonomy available for selection in navigation menus.291 * * If not set, the default is inherited from public.292 * - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget.293 * * If not set, the default is inherited from show_ui.294 * - show_in_quick_edit - Whether to show the taxonomy in the quick/bulk edit panel.295 * * It not set, the default is inherited from show_ui.296 * - show_admin_column - Whether to display a column for the taxonomy on its post type listing screens.297 * * Defaults to false.298 * - meta_box_cb - Provide a callback function for the meta box display.299 * * If not set, defaults to post_categories_meta_box for hierarchical taxonomies300 * and post_tags_meta_box for non-hierarchical.301 * * If false, no meta box is shown.302 * - capabilities - Array of capabilities for this taxonomy.303 * * You can see accepted values in this function.304 * - rewrite - Triggers the handling of rewrites for this taxonomy. Defaults to true, using $taxonomy as slug.305 * * To prevent rewrite, set to false.306 * * To specify rewrite rules, an array can be passed with any of these keys307 * * 'slug' => string Customize the permastruct slug. Defaults to $taxonomy key308 * * 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true.309 * * 'hierarchical' => bool Either hierarchical rewrite tag or not. Defaults to false.310 * * 'ep_mask' => const Assign an endpoint mask.311 * * If not specified, defaults to EP_NONE.312 * - query_var - Sets the query_var key for this taxonomy. Defaults to $taxonomy key313 * * If false, a taxonomy cannot be loaded at ?{query_var}={term_slug}314 * * If specified as a string, the query ?{query_var_string}={term_slug} will be valid.315 * - update_count_callback - Works much like a hook, in that it will be called when the count is updated.316 * * Defaults to _update_post_term_count() for taxonomies attached to post types, which then confirms317 * that the objects are published before counting them.318 * * Defaults to _update_generic_term_count() for taxonomies attached to other object types, such as links.319 * - _builtin - true if this taxonomy is a native or "built-in" taxonomy. THIS IS FOR INTERNAL USE ONLY!320 *321 * @todo Document $args as a hash notation.322 *323 272 * @since 2.3.0 324 273 * @since 4.2.0 Introduced `show_in_quick_edit` argument. … … 330 279 * @param string $taxonomy Taxonomy key, must not exceed 32 characters. 331 280 * @param array|string $object_type Name of the object type for the taxonomy object. 332 * @param array|string $args See optional args description above. 281 * @param array|string $args { 282 * Optional. Array or query string of arguments for registering a taxonomy. 283 * 284 * @type string $label Name of the taxonomy shown in the menu. Usually plural. If not set, 285 * `$labels['name']` will be used. 286 * @type array $labels An array of labels for this taxonomy. By default, Tag labels are used for 287 * non-hierarchical taxonmies, and Category labels are used for hierarchical 288 * taxonomies. See accepted values in get_taxonomy_labels(). 289 * Default empty array. 290 * @type string $description A short descriptive summary of what the taxonomy is for. Default empty. 291 * @type bool $public Whether the taxonomy is publicly queryable. Default true. 292 * @type bool $hierarchical Whether the taxonomy is hierarchical. Default false. 293 * @type bool $show_ui Whether to generate and allow a UI for managing terms in this taxonomy in 294 * the admin. If not set, the default is inherited from `$public` 295 * (default true). 296 * @type bool $show_in_menu Whether to show the taxonomy in the admin menu. If true, the taxonomy is 297 * shown as a submenu of the object type menu. If false, no menu is shown. 298 * `$show_ui` must be true. If not set, default is inherited from `$show_ui` 299 * (default true). 300 * @type bool $show_in_nav_menus Makes this taxonomy available for selection in navigation menus. If not 301 * set, the default is inherited from `$public` (default true). 302 * @type bool $show_tagcloud Whether to list the taxonomy in the Tag Cloud Widget controls. If not set, 303 * the default is inherited from `$show_ui` (default true). 304 * @type bool $show_in_quick_edit Whether to show the taxonomy in the quick/bulk edit panel. It not set, 305 * the default is inherited from `$show_ui` (default true). 306 * @type bool $show_admin_column Whether to display a column for the taxonomy on its post type listing 307 * screens. Default false. 308 * @type bool|callable $meta_box_cb Provide a callback function for the meta box display. If not set, 309 * post_categories_meta_box() is used for hierarchical taxonomies, and 310 * post_tags_meta_box() is used for non-hierarchical. If false, no meta 311 * box is shown. 312 * @type array $capabilities { 313 * Array of capabilities for this taxonomy. 314 * 315 * @type string $manage_terms Default 'manage_categories'. 316 * @type string $edit_terms Default 'manage_categories'. 317 * @type string $delete_terms Default 'manage_categories'. 318 * @type string $assign_terms Default 'edit_posts'. 319 * } 320 * @type bool|array $rewrite { 321 * Triggers the handling of rewrites for this taxonomy. Default true, using $taxonomy as slug. To prevent 322 * rewrite, set to false. To specify rewrite rules, an array can be passed with any of these keys: 323 * 324 * @type string $slug Customize the permastruct slug. Default `$taxonomy` key. 325 * @type bool $with_front Should the permastruct be prepended with WP_Rewrite::$front. Default true. 326 * @type bool $hierarchical Either hierarchical rewrite tag or not. Default false. 327 * @type int $ep_mask Assign an endpoint mask. Default `EP_NONE`. 328 * } 329 * @type string $query_var Sets the query var key for this taxonomy. Default `$taxonomy` key. If 330 * false, a taxonomy cannot be loaded at `?{query_var}={term_slug}`. If a 331 * string, the query `?{query_var}={term_slug}` will be valid. 332 * @type callable $update_count_callback Works much like a hook, in that it will be called when the count is 333 * updated. Default _update_post_term_count() for taxonomies attached 334 * to post types, which confirms that the objects are published before 335 * counting them. Default _update_generic_term_count() for taxonomies 336 * attached to other object types, such as users. 337 * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! 338 * Default false. 339 * } 333 340 * @return WP_Error|void WP_Error, if errors. 334 341 */
Note: See TracChangeset
for help on using the changeset viewer.