Last active
June 16, 2023 11:30
-
-
Save kimwhite/fea1f9e1daf49dce8d3a5fe40b8a55b0 to your computer and use it in GitHub Desktop.
Allow Manager Role to see Admin Bar when using WooCommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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