I finally found the solution.
function checkUserPermissionsInThisScreen(){
if (is_admin()){
$currentUserRoles = wp_get_current_user()->roles;
if (in_array('shop_manager', $currentUserRoles)){
$a = get_current_screen();
if ($a->id != 'edit-shop_order' && $a->post_type != 'shop_order'){
wp_die('you do not have needed permissions to see this page');
}
}
}
}
add_action('current_screen', 'checkUserPermissionsInThisScreen');
Related Posts:
- In WooCommerce filter the available Payment Methods by User Role [closed]
- Admin access for custom user capabilities
- WP_Query with meta_query for children
- WooCommerce limited role
- Tried to create a user role that can only edit user information, but my test account cannot view the dashboard. What am I missing?
- how to remove some permissions from a shop “manager role” in woocommmerce?
- WooCommerce which roles and capabilities control user login re-direct to Woo Account Page?
- WooCommerce Admin order – Only run action if user is loaded
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- How to make an edit to an already published post back to Draft
- I have 3 types of prices in WP and I need to change price for each specific user role using hooks
- Switch to user link shortcode
- How to show specific admin menu to specific user role?
- Assign user role by text field in WordPress (Woocommerce) [closed]
- Need help with woocommerce roles
- How to change user role after login?
- Woocommerce customer role doesn’t change if user is already a subscriber [closed]
- Changing second user role while updating/downgrading membership level – s2member [closed]
- How to add a menu page for options in wordpress for user that has the role of vendor?
- How to disable the “Upgrade or Downgrade” button in “My account” of WooCommerce Subscriptions
- Can I remove WooCommerce specific product categories from shop managers?
- Add another user role based on a defined input field in WordPress (Woocommerce)
- Removing unwanted role after purchase
- Check IF is a “single product page” and Check the “role” for a Redirect
- Woocommerce add extra field to variation product
- single-product.php template not working for single products [closed]
- Remove Posts Quick Edit link for specific user role? WP 3.3
- How to execute a javascript function just before saving a woocommerce post or a post?
- Expanding the allowed HTML tags in comments?
- Change Meta Title seperator and remove on homepage
- WooCommerce Description and Short Description tags removal
- Woocommerce 2.5.5 get billing email from order instance
- Woocommerce products are not displayed on front-end . No products were found matching your selection [closed]
- Custom Text on Product Page based on Shipping Class [closed]
- Shipping Location based on IP (Geolocation)
- How to set a minimum length for username in Woocommerce? [closed]
- How to get term name with link for specific ids
- woocommerce “publish “”product”” webhook
- Creating woocommerce product using WordPress REST API
- Managing Users and Creating Groups [closed]
- Image is not displayed in overridden woocommerce email
- remove categories from product
- woo commerce get all orders item given category
- Fix permissions for users role
- Add Stripe Connect data to wc_stripe_payment_request
- WooCommerce get default shipping rate & conditions
- Using WooCommerce for payments only?
- Programatically Remove Item from Cart Not Working – Needs Page Refresh
- Set default value field meta_Value [closed]
- WooCommerce Cart Link based on Cookie Values
- Limit a user to have access to only specified pages?
- woocommerce – customise notice error in checkout page
- Using a filter to change a path
- Woocommerce, prevent login after registration and redirect to custom URL
- Order with custom order status disappeared once the page is refreshed
- WooCommerce Product detail page: Add content under thumbnails [closed]
- How to add product filter dropdown in woo commerce order page?
- Unable to paste google analytics con header.php [closed]
- Add Attribute to Woocommerce programatically, doesn’t display front end [closed]
- How to add only a (sub) capacity to an user role?
- Link a button to woofunnels model
- Woocommerce – Add additional item if some item wants to be added to the cart?
- Hook “wp_trash_post” executing multiple time in case of bulk trash products
- WooCommerce Subscriptions: Hide one variation subscription
- Contact form 7 send product PDF after submit
- Add sub variations in product page
- Woo commerce product quantity wise SKU
- Override une fonction dans une class Woocommerce
- What to do if images are not displayed in mob. versions of the online store on wordpress?
- validation field form registration vendor dokan woocommerce
- Delete unpublished woocommerce products
- List of JS events in the WooCommerce frontend
- Block access to plugins.php for custom role
- Redirecting orders by company field
- WooCommerce Product Search box with 3 dropdown menus
- Split taxonomies on different pages
- woocommerce REST api on the website’s front-end
- How can I change field values of posts before displaying
- WC Booking query bookings with date ranges
- Disable theme WooCommerce template [closed]
- WooCommerce: how to set stock per attribute on variable product
- How to display products in sidebar in 2 columns?
- Replace “Add to cart” by a link to contact page on specific product
- Increase load-out-page speed
- WooCommerce Stucked (?) – Edit dimensions
- Use Product Attribute in conditional tag
- How to add a fixed shopping cart button on the bottom of the page?
- How to Display Amount of products being displayed out of the amount in category – WordPress/Woocommerce
- Echo SKU in WooCommerce Conformation page [closed]
- Permission to change post Author
- Woocommerce shows empty columns [closed]
- Product atributes in title of order (not in description)
- How to create custome pdf file of my invioice in wordpress
- How to get sub items of parent menu item?
- WordPress and WooCommerce How to Assign Attribute Based Pricing
- Disable Woocommerce checkout based on user role [closed]
- Storefront Child Theme show product attribute [closed]
- How might I enable a user to view Draft pages from a different Author, without the ability to edit?
- Critical error on woocommerce checkout page
- Optimizing or rewriting core queries