OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

How to Allow Different WordPress User Roles Access to the OptinMonster Plugin

How to Allow Different WordPress User Roles Access to the OptinMonster Plugin

If you’re using the OptinMonster plugin for WordPress you can grant access to non-Admin users.

In this article, you’ll learn how to give access to the OptinMonster plugin to other user-roles.

Before You Start

Here are some things to know before you begin:

  • By default, only Administrators (and Super-Administrators for multi-site installs) are allowed to access the OptinMonster plugin.
  • Before adding any code provided in this guide to your site, you should perform a complete site backup.
  • The example code provided in this guide requires that your site is using PHP 5.3 or higher. WordPress strongly recommends using PHP 7+. You can check and upgrade the version of PHP running your site through your hosting account.
  • Adding PHP Code to your site does pose some risks if the code is not added correctly. It could even potentially break your site and your access to the administrative area.
    We recommend using the Code Snippets plugin or adding the code via FTP to your site’s functions.php file.

Grant Access

To provide access to lower user-roles, follow these steps:

  1. Determine the user-role you would like to grand access to. In this example, we provide access to Editor user-role.
  2. Add the following code to your site:
    add_filter( 'optin_monster_api_menu_cap', function( $cap ) { return 'edit_pages'; } );

 

Troubleshooting

What are the Code Snippets for each user role?

Allow Editors and Above:

add_filter( 'optin_monster_api_menu_cap', function( $cap ) { return 'edit_pages'; } );

Allow Authors and Above:

add_filter( 'optin_monster_api_menu_cap', function( $cap ) { return 'publish_posts'; } );

Allow Contributors and Above:

add_filter( 'optin_monster_api_menu_cap', function( $cap ) { return 'edit_posts'; } );
After I added my code, my website is no longer working, what happened!?

Check the console for any errors in the code you’ve added.

WPBeginner offers a debugging guide for WordPress here.

Also, make sure that you’ve added your code between the PHP tags. Some developers add a closing PHP tag, and if you add the code snippet after the closing PHP tag then it can break your site.

Most likely something was copied incorrectly or pasted in the wrong location. You can either (1) restore the backup you made in Step 1 or (2) you can use FTP to manually remove that code you just added.

After I updated my theme, the lower user role no longer has access to OptinMonster. Why?

This is most likely because you manually added the code to your functions.php file and it probably got overwritten with the theme’s update. You can re-add the code again to the current active theme or you can use the Code Snippets plugin.


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