Would you like to hide the Marketing tab from inside your form builder? If you have many users with various roles on your site and using the Access Controls has given them access to WPForms, perhaps you don’t want them to have the ability to set up any integrations on your forms. Using a small PHP snippet you can easily hide the marketing tab and in this tutorial, we’re going to show you how!
Hiding the Marketing tab
By default, any user with the correct permissions can create forms on your site through the WPForms form builder with all available options.
For the purpose of this tutorial, we want to hide the Marketing tab from within the form builder to all users who have the WordPress role of Subscriber or Editor. In order to achieve this, we’ll need to copy this snippet to our site.
If you need assistance with how and where to add snippets to your site, please review this tutorial.
/** * Hide the Marketing tab inside the form builder * * @link https://wpforms.com/developers/how-to-hide-the-marketing-tab-in-form-builder/ */ function hide_marketing_tab_based_on_role() { // Default WordPress User Roles: subscriber, editor, contributor, author, administrator // For more information on WordPress roles check out https://wordpress.org/documentation/article/roles-and-capabilities/ // Check if the current user is a subscriber OR an editor if( current_user_can( 'subscriber' ) || current_user_can( 'editor' ) ) { echo '<style> .wpforms-panel-providers-button { display: none !important; } </style>'; } } add_action('admin_head', 'hide_marketing_tab_based_on_role');
For further information on WordPress user roles and capabilities, please check out their documentation.
And that’s all you need to hide the Marketing tab from WordPress users on your site with particular roles. Would you like to add a color picker to your forms? Have a look at our tutorial on How to Add a Color Picker to Your Form.
FAQ
Q: Can I hide the Payments tab as well?
A: If you want to hide the Payments tab as well.
/** * Hide the Payments tab inside the form builder * * @link https://wpforms.com/developers/how-to-hide-the-marketing-tab-in-form-builder/ */ function hide_payments_tab_based_on_role() { // Default WordPress User Roles: subscriber, editor, contributor, author, administrator // For more information on WordPress roles check out https://wordpress.org/documentation/article/roles-and-capabilities/ // Check if the current user is a subscriber OR an editor if( current_user_can( 'subscriber' ) || current_user_can( 'editor' ) ) { echo '<style> .wpforms-panel-payments-button { display: none !important; } </style>'; } } add_action('admin_head', 'hide_payments_tab_based_on_role');
Q: Can I hide the both tabs?
A: You can hide both tabs by using this snippet.
/** * Hide the Payments and Marketing tab inside the form builder * * @link https://wpforms.com/developers/how-to-hide-the-marketing-tab-in-form-builder/ */ function hide_marketing_tab_based_on_role() { // Default WordPress User Roles: subscriber, editor, contributor, author, administrator // For more information on WordPress roles check out https://wordpress.org/documentation/article/roles-and-capabilities/ // Check if current user is subscriber OR editor if( current_user_can( 'subscriber' ) || current_user_can( 'editor' ) ) { echo '<style> .wpforms-panel-providers-button { display: none !important; } .wpforms-panel-payments-button { display: none !important; } </style>'; } } add_action('admin_head', 'hide_marketing_tab_based_on_role');