Skip to content

Instantly share code, notes, and snippets.

@kimwhite
Last active June 16, 2023 11:30
Show Gist options
  • Save kimwhite/fea1f9e1daf49dce8d3a5fe40b8a55b0 to your computer and use it in GitHub Desktop.
Save kimwhite/fea1f9e1daf49dce8d3a5fe40b8a55b0 to your computer and use it in GitHub Desktop.
Allow Manager Role to see Admin Bar when using WooCommerce
<?php // do not copy this line.
/**
* When using WooCommerce and our Manager Role Add On, this will allow our Manager role to see the Admin Bar
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1);
function _wc_disable_admin_bar($prevent_admin_access) {
if (!current_user_can('pmpro_membership_manager')) {
return $prevent_admin_access;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment