How to remove unwanted Hardening Checks

Available with the following:
MainWP Core
Table of Contents

Why Remove Hardening Checks?

MainWP performs security hardening checks on your Child Sites to identify potential security issues. However, some checks may not be relevant to your setup. If you want to remove certain checks from your MainWP Security scan results, you can do so by adding a small code snippet to your MainWP Dashboard.

Disabling Specific Hardening Checks

See here how to easily apply the code snippet using the MainWP Custom Dashboard extension.

To disable individual checks, use the following code snippet:

add_filter( 'mainwp_security_issues_stats', 'mycustom_mainwp_security_issues_stats', 10, 3 );
function mycustom_mainwp_security_issues_stats( $false, $issues, $website ) {
if( is_array( $issues ) && isset( $issues['sec_inactive_themes'] ) ) {
$issues['sec_inactive_themes'] = 'Y';
}
return $issues;
}

In the above example, the Inactive Themes check is disabled. To disable other checks, replace ‘sec_inactive_themes’ with the corresponding identifier from the list below.

• WordPress Version →

'wp_uptodate'

• PHP Version →

'phpversion_matched'

• PHP Error Reporting →

'php_reporting'

• Database Error Reporting →

'db_reporting'

• SSL Protocol →

'sslprotocol'

• Debug Mode →

'debug_disabled'

• Outdated Plugins →

'sec_outdated_plugins'

• Inactive Plugins →

'sec_inactive_plugins'

• Outdated Themes →

'sec_outdated_themes'

• Inactive Themes →

'sec_inactive_themes'

Disabling multiple Hardening Checks

To disable multiple checks with one code snippet, use the following snippet:

add_filter( 'mainwp_security_issues_stats', 'mycustom_mainwp_security_issues_stats', 10, 3 );
function mycustom_mainwp_security_issues_stats( $false, $issues, $website ) {
if( is_array( $issues ) ) {
	$issues['wp_uptodate'] = 'Y';
	$issues['phpversion_matched'] = 'Y';
	$issues['php_reporting'] = 'Y';
	$issues['db_reporting'] = 'Y';
	$issues['sslprotocol'] = 'Y';
	$issues['debug_disabled'] = 'Y';
	$issues['sec_outdated_plugins'] = 'Y';
	$issues['sec_inactive_plugins'] = 'Y';
	$issues['sec_outdated_themes'] = 'Y';
	$issues['sec_inactive_themes'] = 'Y';
}
return $issues;
}

To customize which hardening checks you wish to leave enabled, simply comment them out like this:

add_filter( 'mainwp_security_issues_stats', 'mycustom_mainwp_security_issues_stats', 10, 3 );
function mycustom_mainwp_security_issues_stats( $false, $issues, $website ) {
if( is_array( $issues ) ) {
	//$issues['wp_uptodate'] = 'Y';
	//$issues['phpversion_matched'] = 'Y';
	//$issues['php_reporting'] = 'Y';
	//$issues['db_reporting'] = 'Y';
	//$issues['sslprotocol'] = 'Y';
	$issues['debug_disabled'] = 'Y';
	$issues['sec_outdated_plugins'] = 'Y';
	$issues['sec_inactive_plugins'] = 'Y';
	$issues['sec_outdated_themes'] = 'Y';
	$issues['sec_inactive_themes'] = 'Y';
}
return $issues;
}

Applying the Code Snippet

The easiest way to apply this code is by using the Custom Dashboard extension:
1. Navigate to MainWP Dashboard > Extensions > Custom Dashboard.
2. Open the PHP tab.
3. Paste the code snippet.
4. Click Save Changes.

Still Have Questions?
Search for additional solutions in the MainWP Community or start your own discussion
MainWP Community

Table of Contents

Search MainWP.com

[searchwp_form id="1"]