OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

How to Disable OptinMonster for WordPress Logged in Users

How to Disable OptinMonster for WordPress Logged in Users

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:

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:

  1. Log into the WordPress admin of your site and navigate to the OptinMonster > Campaigns screen.
  2. Hover over the campaign you would like to configure, and click Edit Output Settings below the title.
  3. 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.
  4. Choose from the three options:
    • All Visitors and Logged-In Users
    • Visitors Only (not logged-in)
    • Logged-In Users Only
  5. 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' );

Still stuck?

How can we help?

Last updated on


Start Getting More
Leads & Sales Today
with OptinMonster!

Create and launch smart capture forms today in minutes. What are you waiting for?

Create and launch smart capture forms
today in minutes. What are you waiting for?

OptinMonster has transformed our business. Before integrating their optins, our clients saw a 2% conversion rate from web traffic, which is slightly above the standard for their industry. With the integration of OptinMonster’s lightbox popup, exit-intent technology, split testing, and other tools, our client’s conversion rates soared by an unprecedented 500%. They attracted substantially more customers while spending less on digital advertising. Their success propelled them to the top of their markets, outperforming national chains and other medical spas with much bigger marketing budgets. Our client’s success in their market has distinguished us in our own. We are now one of the most sought-after marketing firms in the industry of aesthetic medicine. We know that the integration of OptinMonster, more than any other tool or marketing strategy, has supported this growth and achievement.

chris zelig medstar media

Chris Zelig

Partner, Medstar Media

OptinMonster has been a game-changer for us. From driving donations to collecting new leads, there is nothing that this simple tool has failed to accomplish. Our lead collection rate has jumped by over 1,000%.

joe lowe american bird conservancy

Joe Lowe

Director of Digital Communications, American Bird Conservancy

Through OptinMonster’s exit-intent popups, we have more than doubled our sales conversion rate. Best of all is the compound effect of using OptinMonster over a long period of time—more conversions mean more customers, which means more word of mouth.

mitch smith, managing director, shockbyte

Mitch Smith

Managing Director, Shockbyte.com