Developers

Customizing the whitelist: a guide

Ignore files and folders in the Malware Scanner with the securityninja_whitelist filter and wildcards.

Use securityninja_whitelist to skip parts of the site during malware scans. Typical case: known false positives you are sure are safe.

Use wildcards such as ? and * when matching files and folders.

add_filter( 'securityninja_whitelist', 'filter_securityninja_whitelist' );

function filter_securityninja_whitelist( $whitelist ) {
  $whitelist[] = '*/ignorefolder/*';
  $whitelist[] = '*/wp-content/uploads/ignore-this/*';
  return $whitelist;
}

* matches any path segment before or after it, so you can whitelist a whole folder:

$whitelist[] = '*/my-specific-folder-name/*';

Introduced in 5.141. Use a current plugin version.

Examples

Whitelist the Classic Editor plugin folder:

$whitelist[] = '*/wp-content/plugins/classic-editor/*';

Or a shorter pattern (matches any folder named classic-editor):

$whitelist[] = '*/classic-editor/*';

Avoid generic folder names that would ignore more than you intend.

Whitelist one file only:

$whitelist[] = '*/wp-content/plugins/classic-editor/classic-editor.php';

Whitelist a plugin upload folder (WP All Import example):

$whitelist[] = '*/wp-content/uploads/wpallimport/*';

Where to add the code

How to include custom code on your website.

Related UI exclusions: Exclude paths from the Malware Scanner and securityninja_malware_exclude_paths.

Still stuck? Get help or contact us.

Larger screenshot

Enlarged image