将 woocommerce 的自定义用户角色添加到仅编辑订单
Add custom User role for woocommerce to Only Edit ORDERS
我写这段代码是为了创建一个名为“支付经理”的自定义用户,这个用户应该只能编辑/查看 woo-commerce 订单,我到处都找过但没有找到任何答案,请参阅代码:
function sitelab_simple_role() {
add_role(
'payment-manager',
'Payment Manager',
array(
'read' => true,
'edit_posts' => true,
'upload_files' => false,
‘manage_woocommerce’ => false,
'manage_woocommerce_orders' => true,
'edit_shop_order' => true,
'edit_shop_order_terms' => true,
'edit_shop_orders' => true,
'manage_shop_order_terms' => true,
'publish_shop_orders' => true,
'read_private_shop_orders' => true,
'read_shop_order' => true,
),
);
}
add_action( 'init', 'sitelab_simple_role' );
由于某些原因,它不允许编辑订单并显示错误消息“您无权执行此操作”
会是什么?
感谢帮手
您缺少一些功能。
array(
'read' => true,
'edit_posts' => true,
'upload_files' => false,
'manage_woocommerce' => false,
'manage_woocommerce_orders' => true,
'edit_shop_order' => true,
'edit_shop_order_terms' => true,
'edit_shop_orders' => true,
'manage_shop_order_terms' => true,
'publish_shop_orders' => true,
'read_private_shop_orders' => true,
'read_shop_order' => true,
'assign_shop_order_terms' => true,
'delete_others_shop_orders' => true,
'delete_private_shop_orders' => true,
'delete_published_shop_orders' => true,
'delete_shop_order' => true,
'delete_shop_order_terms' => true,
'delete_shop_orders' => true,
'edit_others_shop_orders' => true,
'edit_private_shop_orders' => true,
'edit_published_shop_orders' => true,
),
我写这段代码是为了创建一个名为“支付经理”的自定义用户,这个用户应该只能编辑/查看 woo-commerce 订单,我到处都找过但没有找到任何答案,请参阅代码:
function sitelab_simple_role() {
add_role(
'payment-manager',
'Payment Manager',
array(
'read' => true,
'edit_posts' => true,
'upload_files' => false,
‘manage_woocommerce’ => false,
'manage_woocommerce_orders' => true,
'edit_shop_order' => true,
'edit_shop_order_terms' => true,
'edit_shop_orders' => true,
'manage_shop_order_terms' => true,
'publish_shop_orders' => true,
'read_private_shop_orders' => true,
'read_shop_order' => true,
),
);
}
add_action( 'init', 'sitelab_simple_role' );
由于某些原因,它不允许编辑订单并显示错误消息“您无权执行此操作”
会是什么?
感谢帮手
您缺少一些功能。
array(
'read' => true,
'edit_posts' => true,
'upload_files' => false,
'manage_woocommerce' => false,
'manage_woocommerce_orders' => true,
'edit_shop_order' => true,
'edit_shop_order_terms' => true,
'edit_shop_orders' => true,
'manage_shop_order_terms' => true,
'publish_shop_orders' => true,
'read_private_shop_orders' => true,
'read_shop_order' => true,
'assign_shop_order_terms' => true,
'delete_others_shop_orders' => true,
'delete_private_shop_orders' => true,
'delete_published_shop_orders' => true,
'delete_shop_order' => true,
'delete_shop_order_terms' => true,
'delete_shop_orders' => true,
'edit_others_shop_orders' => true,
'edit_private_shop_orders' => true,
'edit_published_shop_orders' => true,
),