How to Disable OptinMonster for Logged in Users

OptinMonster is probably the best way to build an email list. However it can get annoying specially if you have a membership site. Few of our users asked if there was a way to disable OptinMonster for logged in users. Yes there is.

Targeting users following this guide works only with websites that utilize’s Content Management System. It may be possible to target based on the logged-in status on other platforms using the Display Rules in the optin builder or using Google Tag Manager to control where the embed code is loaded on your site.
  1. OptinMonster Plugin
  2. Configure the Output Settings

Step 1 – OptinMonster Plugin

Log into the WordPress Admin and navigate to the OptinMonster > Optins screen. Here you’ll see a list of optins that have been synced to your site from OptinMonster. If you don’t yet see any optins available to configure, select the Refresh Optins button to sync the latest optins.

Next, select the Edit Output Settings link below the title of the specific optin you wish to configure:

Select the Edit Output Settings link to configure where your optin should appear on your site.

Step 2 – Configure the Output Settings

This will open the Output Settings screen where we’ll configure who can see the optin. Look to the Who should see this optin? setting, which has the following options available:

  • Show optin to all visitors and users
  • Show optin to only visitors (not logged-in)
  • Show optin to only users (logged-in)

After specifying your Output Settings, save the changes and visit your site to see the new setting in effect.

Configure the output settings to output the optin embed code only for specific user roles.

That’s it, save the settings and the optin embed code will not be added to your site only if the user’s logged-in status meets the settings defined in the Output Settings!

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.

add_filter( 'optinmonster_output', 'tgm_om_hide_optin_for_user_roles' );
function tgm_om_hide_optin_for_user_roles( $optins ) {

    // Do nothing if no user is logged in.
    if ( ! is_user_logged_in() ) {
        return array();

    // Get the current user.
    $roles = array( 'administrator', 'subscriber' ); // Change these as necessary.
    $user  = wp_get_current_user();
    if ( ! empty( $user->roles ) && is_array( $user->roles ) ) {
        if ( in_array( $roles ), $user->roles ) {
            $optins = array(); // Remove all optins for these particular roles.

    // Return the potentially modified optins.
    return $optins;