Created
June 27, 2016 11:15
-
-
Save strangerstudios/954918484e9307151014c4ccf70e7a81 to your computer and use it in GitHub Desktop.
Disable an OptinMonster optins if user has any membership level.
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
/* | |
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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/