ClicksClick

Disable the Administration Email Verification in WordPress

Disable the Administration Email Verification in WordPress


Sometimes when you log into WordPress you will see a notice with the heading “Administration Email Verification”. This site admin verification screen was added back in WordPress 5.3 as an extra security measure to ensure that your website’s administrator email is accurate.

This is what the screen looks like:

According to WordPress; the email verification screen is to ensure that “site owners remain in full control of their site, even as years go by.” The thought is that sometimes people change their emails and forget to update their website. If your email address isn’t up to date, you will stop receiving critical emails from your site.

Skip to the code snippet

Should You Disable Administration Email Verification Screen?

Whether you should disable the admin email verification screen or not really depends on a per-site basis. If you are the only user of your website and you have full access to the server files and database then it’s not a huge concern to disable it. Same goes for local/development installations of WordPress.

I would recommend keeping it enabled on websites where you can’t possibly change your user email if needed via phpMyAdmin or FTP, websites that have multiple administrators or websites that you manage for your client but you don’t have access to the server.

The reason I wrote this guide is because I was getting annoyed seeing this notice every time I logged into my MAMP Pro localhost. I don’t need to receive any emails from my development site. Additionally, emails don’t get sent anyway as wp_mail() won’t work on a localhost by default.

How to Disable the Administration Email Verification Screen Without a Plugin

Some articles recommend using a plugin to disable the email verification screen. Most of these plugins seem bloated and unnecessary for the task at hand.

For example, WPBeginner.com recommends a plugin named “Make Disable Admin Email Verification Prompt”, which has useless code. I inspected the plugin code. The plugin has functions that flush your site’s rewrite rules on activation/deactivation which is not needed at all. This plugin also adds a new admin setting to toggle the admin email verification screen on and off. Why would you ever need an extra option if you can just enable/disable the plugin itself?

So, if you want to keep your site not bloated, I recommend you use a little code. WordPress actually has a filter named admin_email_check_interval which you can hook into and set to false to easily disable the admin email verification screen.

<?php
/**
* Disable site admin email verification.
*
* @see https://www.wpexplorer.com/disable-wordpress-administration-email-verification/
*/
add_filter( ‘admin_email_check_interval’, ‘__return_false’ );

As you can see all you really need is a single line of code, no need to complicate and bloat up your site with unnecessary plugins. This snippet has a little comment, which you can keep or remove at your discretion. I like adding comments to my code in my guides so people can always go back to the original source.

Often people copy and paste snippets from the internet then have no idea where the code came from. I think it’s a good idea to always have a comment with a link to the code source for future reference.

Using a Plugin to Disable the WordPress Admin Email Verification Notice

Now if you prefer to use a plugin you can download the plugin on Github which just contains the snippet above plus the required plugin header. This way, since the plugin isn’t on WordPress.org you won’t have to worry about updating or or seeing warnings that the plugin isn’t compatible with your version of WordPress. Realistically this plugin should never require any updates either.

If you do download and use the plugin you can rename the folder and main file (wp-disable-admin-email-verification-screen) whatever you want. This way if you wanted to brand it with your company name you can. Be sure to also edit the main file and change the name of the plugin at the top in the plugin header.

Bonus: How to Change the Frequency in which the Admin Email Verification Screen Shows Up

Now, if you don’t want to disable the admin email verification screen completely you can also change the frequency in which it’s shown so it’s a bit less annoying. Below is an example code snippet showing how you can hook into the same admin_email_check_interval filter. But rather than returning __false, like in the first snippet, we modify the actual interval value.

/**
* Increase the admin email check interval to 12 months.
*
* @see https://www.wpexplorer.com/disable-wordpress-administration-email-verification/
*/
add_filter( ‘admin_email_check_interval’, function( $interval ) {
return 12 * MONTH_IN_SECONDS;
} );

This code will change the frequency of the admin email verification screen so that it shows up every 12 months instead of the default interval which is 6 months.

Modify the Admin Email Check Reminder Interval Time

You may have noticed that the administration email reminder screen has a “remind me later” button that you can click. By default this will set the screen to display again in 3 days. If you want you can also modify the time interval between when you click the button and when the reminder displays.

Here is a snippet you can use to change the default 3 day reminder interval time to 7 days:

/**
* Increase the admin email reminder check interval to 7 days.
*
* @see https://www.wpexplorer.com/disable-wordpress-administration-email-verification/
*/
add_filter( ‘admin_email_check_interval’, function( $interval ) {
return 7 * DAY_IN_SECONDS;
} );

Conclusion

Having the admin email verification screen I think is a nice addition in WordPress as it helps make sure administrators keep their email up to date. Personally, I find that it displays way too often and it can get annoying. I don’t believe people are constantly changing their important emails or using non-important emails for their site administrator accounts.

I think it’s a good idea to keep this screen enabled by default, however, in some cases (localhost) it’s nice to disable it. Let me know in the comments if you have any added feedback or the reasons why you would disable or keep the admin email verification screen enabled.



Source link

댓글 달기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다