Hiding the Email Test Menu Item in Settings

Heads up! This article contains PHP code and is intended for developers. We offer this code as a courtesy but don’t provide support for code customizations or 3rd party development.

Overview

Would you like to hide the ‘Email Test’ tab from your WP Mail SMTP settings menu? Although the ‘Email Test’ tab is included in the settings menu for quick access, we understand that some users may prefer to hide it to streamline their workflow.

In this tutorial, we’ll show you how to use a simple PHP code snippet to hide this tab from the settings menu.

Note: Be sure to install and activate the WP Mail SMTP plugin on your site before adding the code snippet provided in this tutorial.

Setup

We recommend that you copy and paste the required snippet below into a new WPCode snippet. WPCode makes it easy and safe to run code snippets on your site.

For help with adding snippets to your site, please see our tutorial on adding code snippets using the WPCode plugin.

Simply copy and paste this snippet into WPCode.

// Hide Email Test tab from the settings menu in the WP Mail SMTP
add_filter( 'wp_mail_smtp_admin_get_pages', function ( $pages ) {

	unset( $pages['test'] );

	return $pages;
}, PHP_INT_MAX );

Note: It’s essential to use a code snippet plugin like WPCode for this adjustment. Making this change directly in the functions.php file won’t work because the filter applies earlier than the theme loads.

This code snippet hides the ‘Email Test’ tab from your settings menu but you’ll still have access to this feature from WP Mail SMTP ยป Tools.

That’s it! Now you know how to adjust the visibility of the ‘Email Test’ tab in your WP Mail SMTP settings menu using a simple PHP code snippet.

Next, want to explore more ways to customize your WP Mail SMTP setup? Be sure to take a look at our other code snippets for more customization options.