How to remove unwanted Hardening Checks - multiple unchecks

Hi,
Following your useful article: https://mainwp.com/kb/how-to-remove-unwanted-hardening-checks/, what is the widget to remove more than one? I tried and broke MainWP…
I want to remove those 3:
• Outdated Plugins → ‘sec_outdated_plugins’
• Inactive Plugins → ‘sec_inactive_plugins’
• Inactive Themes → ‘sec_inactive_themes’
Thanks

Hey @wpexpert

I’ll check with the dev team for more info and get back to you as soon as I can.

@wpexpert

Can you please try using the snippet 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;
}

You can also easily customize which checks you want disabled just by commenting them out:

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;
}
2 Likes

It worked perfectly! Thanks @bojan

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.