|
52 | 52 | * } |
53 | 53 | * add_action( 'wp_abilities_api_init', 'my_plugin_register_abilities' ); |
54 | 54 | * |
55 | | - * Use a category to group related abilities and improve discoverability. The |
56 | | - * `data-export` category must be registered first with `wp_register_ability_category()` |
| 55 | + * Every ability requires a category to group related abilities and improve discoverability. |
| 56 | + * The `data-export` category must be registered first with `wp_register_ability_category()` |
57 | 57 | * on `wp_abilities_api_categories_init`, or the ability registration fails. |
58 | | - * Abilities that omit `category` fall back to the built-in `uncategorized` category. |
59 | 58 | * |
60 | 59 | * Once registered, abilities can be checked, retrieved, and managed: |
61 | 60 | * |
|
148 | 147 | * |
149 | 148 | * ### Categories |
150 | 149 | * |
151 | | - * Abilities can be organized into categories. If no category is provided, the ability is |
152 | | - * assigned to the built-in `uncategorized` category. Custom categories must be registered |
153 | | - * before the abilities that reference them: |
| 150 | + * Every ability must specify a registered category. Categories group related abilities |
| 151 | + * so clients can discover and retrieve relevant subsets. Plugins can reuse an existing |
| 152 | + * category when appropriate, including categories registered by core. Custom categories must be |
| 153 | + * registered on `wp_abilities_api_categories_init` before abilities that reference them |
| 154 | + * are registered on `wp_abilities_api_init`: |
154 | 155 | * |
155 | 156 | * function my_plugin_register_categories(): void { |
156 | 157 | * wp_register_ability_category( |
|
286 | 287 | * |
287 | 288 | * @since 6.9.0 |
288 | 289 | * @since 7.1.0 Added the `public` meta argument. |
289 | | - * @since 7.2.0 The `category` argument is now optional and defaults to `uncategorized`. |
290 | 290 | * @since 7.2.0 Added the `required_capabilities` argument. |
291 | 291 | * |
292 | 292 | * @see WP_Abilities_Registry::register() |
|
304 | 304 | * @type string $label Required. The human-readable label for the ability. |
305 | 305 | * @type string $description Required. A detailed description of what the ability does |
306 | 306 | * and when it should be used. |
307 | | - * @type string $category Optional. The ability category slug this ability belongs to. |
308 | | - * Defaults to `uncategorized`. Custom categories must be registered |
309 | | - * via `wp_register_ability_category()` before registering the ability. |
| 307 | + * @type string $category Required. The registered ability category slug this ability belongs to. |
| 308 | + * Custom categories must be registered via |
| 309 | + * `wp_register_ability_category()` before registering the ability. |
310 | 310 | * @type callable $execute_callback Required. A callback function to execute when the ability is invoked. |
311 | 311 | * Receives optional mixed input data and must return either a result |
312 | 312 | * value (any type) or a `WP_Error` object on failure. |
@@ -707,10 +707,8 @@ function _wp_get_abilities_match_meta( array $meta, array $conditions ): bool { |
707 | 707 | * Registers a new ability category. |
708 | 708 | * |
709 | 709 | * Ability categories provide a way to organize and group related abilities for better |
710 | | - * discoverability and management. Custom categories must be registered before abilities |
711 | | - * that reference them. Abilities that omit a category are assigned to the built-in |
712 | | - * `uncategorized` category, which is intended as an escape hatch for simple or transitional |
713 | | - * registrations. |
| 710 | + * discoverability and management. Every ability requires a registered category. |
| 711 | + * Custom categories must be registered before abilities that reference them. |
714 | 712 | * |
715 | 713 | * Ability categories must be registered on the `wp_abilities_api_categories_init` action hook. |
716 | 714 | * |
|
0 commit comments