Title: WP_Ability_Categories_Registry::register
Published: February 24, 2026

---

# WP_Ability_Categories_Registry::register( string $slug,  $args ): 󠀁[WP_Ability_Category](https://developer.wordpress.org/reference/classes/wp_ability_category/)󠁿|null

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#wp--skip-link--target)

Registers a new ability category.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#description)󠁿

Do not use this method directly. Instead, use the `wp_register_ability_category()`
function.

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#see-also)󠁿

 * [wp_register_ability_category()](https://developer.wordpress.org/reference/functions/wp_register_ability_category/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#parameters)󠁿

 `$slug`stringrequired

The unique slug for the ability category. Must contain only lowercase alphanumeric
characters and dashes.

mixed> $args { An associative array of arguments for the ability category.
 @type
string $label The human-readable label for the ability category. @type string $description
A description of the ability category. @type array<string, mixed> $meta Optional.
Additional metadata for the ability category. }

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#return)󠁿

 [WP_Ability_Category](https://developer.wordpress.org/reference/classes/wp_ability_category/)
|null The registered ability category instance on success, null on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#source)󠁿

    ```php
    public function register( string $slug, array $args ): ?WP_Ability_Category {
    	if ( $this->is_registered( $slug ) ) {
    		_doing_it_wrong(
    			__METHOD__,
    			/* translators: %s: Ability category slug. */
    			sprintf( __( 'Ability category "%s" is already registered.' ), esc_html( $slug ) ),
    			'6.9.0'
    		);
    		return null;
    	}

    	if ( ! preg_match( '/^[a-z0-9]+(?:-[a-z0-9]+)*$/', $slug ) ) {
    		_doing_it_wrong(
    			__METHOD__,
    			__( 'Ability category slug must contain only lowercase alphanumeric characters and dashes.' ),
    			'6.9.0'
    		);
    		return null;
    	}

    	/**
    	 * Filters the ability category arguments before they are validated and used to instantiate the ability category.
    	 *
    	 * @since 6.9.0
    	 *
    	 * @param array<string, mixed> $args {
    	 *     The arguments used to instantiate the ability category.
    	 *
    	 *     @type string               $label       The human-readable label for the ability category.
    	 *     @type string               $description A description of the ability category.
    	 *     @type array<string, mixed> $meta        Optional. Additional metadata for the ability category.
    	 * }
    	 * @param string               $slug The slug of the ability category.
    	 */
    	$args = apply_filters( 'wp_register_ability_category_args', $args, $slug );

    	try {
    		// WP_Ability_Category::prepare_properties() will throw an exception if the properties are invalid.
    		$category = new WP_Ability_Category( $slug, $args );
    	} catch ( InvalidArgumentException $e ) {
    		_doing_it_wrong(
    			__METHOD__,
    			$e->getMessage(),
    			'6.9.0'
    		);
    		return null;
    	}

    	$this->registered_categories[ $slug ] = $category;
    	return $category;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/abilities-api/class-wp-ability-categories-registry.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/abilities-api/class-wp-ability-categories-registry.php#L57)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/abilities-api/class-wp-ability-categories-registry.php#L57-L107)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_register_ability_category_args’, array<string, , string $slug )](https://developer.wordpress.org/reference/hooks/wp_register_ability_category_args/)

Filters the ability category arguments before they are validated and used to instantiate
the ability category.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Ability_Categories_Registry::is_registered()](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/is_registered/)`wp-includes/abilities-api/class-wp-ability-categories-registry.php` |

Checks if an ability category is registered.

  | 
| [WP_Ability_Category::__construct()](https://developer.wordpress.org/reference/classes/wp_ability_category/__construct/)`wp-includes/abilities-api/class-wp-ability-category.php` |

Constructor.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` |

Escaping for HTML blocks.

  | 
| [_doing_it_wrong()](https://developer.wordpress.org/reference/functions/_doing_it_wrong/)`wp-includes/functions.php` |

Marks something as being incorrectly called.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 4 more](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_ability_categories_registry/register/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.9.0](https://developer.wordpress.org/reference/since/6.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_ability_categories_registry%2Fregister%2F)
before being able to contribute a note or feedback.