wp_register_ability_category_args
云策文档标注
概述
本文档介绍了 wp_register_ability_category_args 过滤器,它允许在验证和实例化能力类别参数之前修改这些参数。此过滤器主要用于 WordPress 开发者自定义能力类别的注册过程。
关键要点
- wp_register_ability_category_args 是一个过滤器,用于在能力类别参数被验证和实例化前进行修改。
- 过滤器接收两个参数:$args(能力类别的参数数组)和 $slug(能力类别的 slug)。
- 参数 $args 包括 label(标签)、description(描述)和可选的 meta(元数据)。
- 此过滤器在 WP_Ability_Categories_Registry::register() 方法中被调用,用于注册新的能力类别。
- 该过滤器从 WordPress 6.9.0 版本开始引入。
代码示例
$args = apply_filters( 'wp_register_ability_category_args', $args, $slug );
原文内容
Filters the ability category arguments before they are validated and used to instantiate the ability category.
Parameters
-
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 $meta Optional. Additional metadata for the ability category.
} $slugstring-
The slug of the ability category.
Source
$args = apply_filters( 'wp_register_ability_category_args', $args, $slug );
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |