Skip to content

Commit a53d52a

Browse files
Abilities API: Add the core/terms-query, core/term-create, core/term-update and core/term-delete abilities.
Adds four abilities for the terms of the taxonomies that set the new `show_in_abilities` argument of `register_taxonomy()`, which is on for `category` and `post_tag`. `core/terms-query` returns a page of the terms of a taxonomy with the totals, filtered by IDs, slugs, parent, post or `hide_empty`. `core/term-create`, `core/term-update` and `core/term-delete` create, change and permanently delete a term. The create and update abilities return the term in the same form as the query. The abilities require a logged-in user, and each call checks the capabilities of the user for the taxonomy and the term. A default term cannot be deleted. See #66743.
1 parent a5c41fa commit a53d52a

11 files changed

Lines changed: 7379 additions & 0 deletions

‎src/wp-includes/abilities.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
require_once __DIR__ . '/abilities/class-wp-abilities-content.php';
1313
require_once __DIR__ . '/abilities/class-wp-abilities-settings.php';
14+
require_once __DIR__ . '/abilities/class-wp-abilities-terms.php';
1415
require_once __DIR__ . '/abilities/class-wp-abilities-users.php';
1516

1617
/**
@@ -50,6 +51,7 @@ function wp_register_core_ability_categories(): void {
5051
*
5152
* @since 6.9.0
5253
* @since 7.2.0 Added the `core/content-query`, `core/settings-get`, and `core/users-query` abilities.
54+
* @since 7.3.0 Added the `core/terms-query`, `core/term-create`, `core/term-update`, and `core/term-delete` abilities.
5355
*
5456
* @global wpdb $wpdb WordPress database abstraction object.
5557
*/
@@ -379,4 +381,7 @@ function wp_register_core_abilities(): void {
379381

380382
// Register the content abilities (currently the read-only `core/content-query`).
381383
( new WP_Abilities_Content() )->register();
384+
385+
// Register the term abilities: `core/terms-query`, `core/term-create`, `core/term-update`, and `core/term-delete`.
386+
( new WP_Abilities_Terms() )->register();
382387
}

0 commit comments

Comments
 (0)