Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created June 27, 2016 11:15
Show Gist options
  • Save strangerstudios/954918484e9307151014c4ccf70e7a81 to your computer and use it in GitHub Desktop.
Save strangerstudios/954918484e9307151014c4ccf70e7a81 to your computer and use it in GitHub Desktop.
Disable an OptinMonster optins if user has any membership level.
/*
Disable an OptinMonster optins if user has any membership level.
Replace YOUR_OPTIN_SLUG with the slug of the optin you want to remove for members
OptinMonster is a premium plugin available here:
http://optinmonster.com/
*/
function my_pmpro_om_remove_optins() {
global $current_user;
if ( pmpro_hasMembershipLevel() )
{
echo "<script type='text/javascript'>
jQuery(document).ready(function($){
jQuery(document).on('OptinMonsterBeforeShow', function(event, data, object){
jQuery('#om-YOUR_OPTIN_SLUG').remove();
});
});
</script>";
}
}
add_action( 'wp_footer', 'my_pmpro_om_remove_optins' );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Membership Logic to Enable or Disable Popups for Popular WordPress Popup Plugins" at Paid Memberships Pro here: https://www.paidmembershipspro.com/membership-logic-enable-disable-popups-popup-maker-popups-optinmonster/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment