Want to avoid annoying active users with your campaigns? It’s easy with OptinMonster’s WordPress plugin!
In this article, you will learn how to automatically disable OptinMonster for logged-in users within WordPress.
Before You Start
Here are some things to know before you begin:
- This guide is specific to WordPress sites using the OptinMonster WordPress plugin.
- It may be possible to target based on the logged-in status on other platforms using the display rules in the campaign Builder or using Google Tag Manager to control where the embed code is loaded on your site.
Disable for Logged In Users
This feature is great to use if you want to target a specific audience within WordPress. Do you want to show your campaigns to guests and not bother your logged-in users?
When you are ready to hide certain campaigns from logged-in users, follow these steps:
- Log into the WordPress admin of your site and navigate to the OptinMonster > Campaigns screen.
- Hover over the campaign you would like to configure, and click Edit Output Settings below the title.
- In the Visibility & Status box on the right side of the screen, choose the audience you’d like to show the campaign to from the Who should see this campaign? dropdown field.
- Choose from the three options:
- All Visitors and Logged-In Users
- Visitors Only (not logged-in)
- Logged-In Users Only
- When you are finished click Save Changes.
FAQs
How can I disable OptinMonster campaigns for visitors with specific user roles?
If you want to disable OptinMonster for a specific user role in your membership site, then simply paste the following code in your theme’s functions.php file.
function om_docs_hide_optin_for_user_roles( $campaigns ) {
// Do nothing if no user is logged in.
if ( ! is_user_logged_in() ) {
return $campaigns;
}
// Change these as necessary.
$roles_to_check = array( 'administrator', 'subscriber' );
// Get the current user.
$user = wp_get_current_user();
if ( ! empty( $user->roles ) && is_array( $user->roles ) ) {
$has_role = array_intersect( $roles_to_check, $user->roles );
if ( ! empty( $has_role ) ) {
// Remove all campaigns for these particular roles.
$campaigns = array();
}
}
// Return the potentially modified campaigns.
return $campaigns;
}
add_filter( 'optin_monster_api_final_output', 'om_docs_hide_optin_for_user_roles' );
If you’re serious about jumpstarting your website business growth, then get started with OptinMonster today!
Get Started With OptinMonster Today!BONUS: Done-For-You Campaign Setup ($297 value)
Our conversion experts will design 1 free campaign for you to get maximum results – absolutely FREE!
Click here to get started →