Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created December 11, 2018 09:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewlimaza/0ee2a2529af23aa37737c9944defdfc3 to your computer and use it in GitHub Desktop.
Save andrewlimaza/0ee2a2529af23aa37737c9944defdfc3 to your computer and use it in GitHub Desktop.
Remove custom sidebar based on membership level.
<?php
/**
* Remove custom sidebar based on user's membership level.
* Add this code to your PMPro Customizations Plugin -
*/
function my_pmpro_hide_sidebar_from_members(){
if ( ! pmpro_hasMembershipLevel( 1 ) ) {
unregister_sidebar( 'my-sidebar-id' );
}
}
add_action( 'init', 'my_pmpro_hide_sidebar_from_members' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment