0

My question is about WordPress in general. How can I give admins the ability to log in and do things that other users can do?

My specific use-case for this is, in WooCommerce, when an admin creates an order via the "Add New Order" page and assigns it to a user the admin can not view the order or complete checkout. If the admin tries to view the page he gets this error - "This order cannot be paid for. Please contact us if you need assistance."

Is there a way to work around this? I would prefer not to use a plugin.

1

You'll need to find out what specific capabilities Admin users are missing. Once you know the full list, you can use add_cap() to add those capabilities to the Admin users and enable them to do whatever the other roles are doing.

From Shold I manually add 'cap' to admin role ? -

$role = get_role( 'administrator' );
$role->add_cap( 'cap' );

Replace cap with one of the capabilities you need to add to admin users. Copy and paste that second line, and add each additional capability separately.

  • 1
    Thank you! I found the correct capability, "pay_for_order", added that and it works great. $role->add_cap('pay_for_order'); – Jon Jan 7 at 18:26

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.