Created
June 18, 2024 09:56
-
-
Save ipokkel/3a75e8f8fd7bbe16bb957b9a03a07de3 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Hide the WordPress toolbar for all users that do not have | |
* the administrative 'manage_options' capability. | |
* | |
* 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/ | |
*/ | |
function hide_toolbar_for_non_admins( $hide ) { | |
if ( ! current_user_can( 'manage_options' ) ) { | |
$hide = true; | |
} | |
return $hide; | |
} | |
add_filter( 'pmpro_hide_toolbar', 'hide_toolbar_for_non_admins' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment