# wp_register_ability_category()

URL: https://chugunov.pro/api-wordpress/functions/wp_register_ability_category/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 6.9.0.

## Сигнатура

```php
wp_register_ability_category( string $slug, $args ): WP_Ability_Category|null
```

## Описание

Ability categories provide a way to organize and group related abilities for better discoverability and management. Ability categories must be registered before abilities that reference them.

Ability categories must be registered on the `wp_abilities_api_categories_init` action hook.

Example:

```
function my_plugin_register_categories() {
wp_register_ability_category(
'content-management',
array(
'label' => __( 'Content Management', 'my-plugin' ),
'description' => __( 'Abilities for managing and organizing content.', 'my-plugin' ),
)
);
}
add_action( 'wp_abilities_api_categories_init', 'my_plugin_register_categories' );
```

[See also](#see-also)
- [WP_Ability_Categories_Registry::register()](https://developer.wordpress.org/reference/classes/WP_Ability_Categories_Registry/register/)

- [wp_register_ability()](https://developer.wordpress.org/reference/functions/wp_register_ability/)

- [wp_unregister_ability_category()](https://developer.wordpress.org/reference/functions/wp_unregister_ability_category/)

## Параметры

- `$slug` `string` — обязательный. Уникальный слаг категории способностей. Может содержать только строчные буквенно-цифровые символы и дефисы (например, 'data-export').

## Возвращаемое значение

`WP_Ability_Category|null` — null

## Исходный код

Файл: `wp-includes/abilities-api.php:467`

```php
function wp_register_ability_category( string $slug, array $args ): ?WP_Ability_Category {
	if ( ! doing_action( 'wp_abilities_api_categories_init' ) ) {
		_doing_it_wrong(
			__FUNCTION__,
			sprintf(
				/* translators: 1: wp_abilities_api_categories_init, 2: ability category slug. */
				__( 'Ability categories must be registered on the %1$s action. The ability category %2$s was not registered.' ),
				'<code>wp_abilities_api_categories_init</code>',
				'<code>' . esc_html( $slug ) . '</code>'
			),
			'6.9.0'
		);
		return null;
	}

	$registry = WP_Ability_Categories_Registry::get_instance();
	if ( null === $registry ) {
		return null;
	}

	return $registry->register( $slug, $args );
}
```

## История изменений

- 6.9.0 — Introduced.

## Связанные

Использует: `WP_Ability_Categories_Registry::get_instance`, [`doing_action`](https://chugunov.pro/api-wordpress/functions/doing_action/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`esc_html`](https://chugunov.pro/api-wordpress/functions/esc_html/), [`_doing_it_wrong`](https://chugunov.pro/api-wordpress/functions/_doing_it_wrong/).
Используется в: [`wp_register_core_ability_categories`](https://chugunov.pro/api-wordpress/functions/wp_register_core_ability_categories/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_register_ability_category/
