0

I'm running WooCommerce and have added a user with the role 'Shop Manager'.

I'd like the Shop Manager to have the ability to add users.

Here's my code:

function shop_manager_add_users() {
    $role = get_role( 'shop_manager' );
    $role->add_cap( 'add_users' );
}

add_action( 'admin_init', 'shop_manager_add_users');

However, when I log in as the Shop Manager, they are still unable to add users. What am I doing wrong here?

  • 1
    use create_users capability instead of add_users capability. – Kanon Chowdhury Jun 14 '18 at 9:44
1

add_users capability is only used for backward compatibility. so we should use create_users capability instead of add_users capability.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.