(capability)_roles
Filter: Allow changing roles that a capability is added to.
Использование
add_filter( '(capability)_roles', 'wp_kama_capability_roles_filter' ); /** * Function for `(capability)_roles` filter-hook. * * @param array $roles The default roles to be filtered. * * @return array */ function wp_kama_capability_roles_filter( $roles ){ // filter... return $roles; }
- $roles(массив)
- The default roles to be filtered.
Где вызывается хук
(capability)_roles
yoast/admin/capabilities/class-abstract-capability-manager.php 82
$filtered = apply_filters( $capability . '_roles', $roles );
Где используется хук в Yoast SEO
yoast/admin/roles/class-register-roles.php 19
add_action( 'wpseo_register_roles', [ $this, 'register' ] );