wp-includes/abilities-api/class-wp-ability-categories-registry.php:57Registers a new ability category.
$slugstring$argsarrayWP_Ability_Category|nullOne hook fires while WP_Ability_Categories_Registry::register() runs, in this order:
Filters the ability category arguments before they are validated and used to instantiate the ability category.
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; }Introduced in 6.9.0. Unchanged from 6.9.7 through 7.1.0.
Signature, return type and hooks compared across 3 parsed releases.
src/wp-includes/abilities-api/class-wp-ability-categories-registry.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.