wc_shop_manager_has_capability()
Safe way of allowing shop managers restricted capabilities that will remove access to the capabilities if WooCommerce is deactivated.
Хуков нет.
Возвращает
true|false[]
.
Использование
wc_shop_manager_has_capability( $allcaps, $caps, $args, $user );
- $allcaps(bool[]) (обязательный)
- Array of key/value pairs where keys represent a capability name and boolean values represent whether the user has that capability.
- $caps(string[]) (обязательный)
- Required primitive capabilities for the requested capability.
- $args(массив) (обязательный)
- Arguments that accompany the requested capability check.
- $user(WP_User) (обязательный)
- The user object.
Список изменений
С версии 3.5.4 | Введена. |
Код wc_shop_manager_has_capability() wc shop manager has capability WC 9.8.1
function wc_shop_manager_has_capability( $allcaps, $caps, $args, $user ) { if ( wc_user_has_role( $user, 'shop_manager' ) ) { // @see wc_modify_map_meta_cap, which limits editing to customers. $allcaps['edit_users'] = true; } return $allcaps; }