-
-
Save kimwhite/cd4aa8b08560d5dfaec728a5a1035c02 to your computer and use it in GitHub Desktop.
Hide a level from non-members
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. | |
/** | |
* This recipe will hide level 2 from non-members | |
* | |
* 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 adjusting_the_pmpro_levels_array( $levels ) { | |
if( !pmpro_hasMembershipLevel() ) { | |
unset( $levels[2] ); // hide level 14 from non-members | |
} | |
return $levels; | |
} | |
add_filter( 'pmpro_levels_array', 'adjusting_the_pmpro_levels_array' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment