Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created December 11, 2018 09:12
Show Gist options
  • 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