Skip to content

Instantly share code, notes, and snippets.

@amilabandara
Created March 1, 2021 03:50
Show Gist options
  • Save amilabandara/ae9ef9c155d26c0d29d2528a86738ff0 to your computer and use it in GitHub Desktop.
Save amilabandara/ae9ef9c155d26c0d29d2528a86738ff0 to your computer and use it in GitHub Desktop.
Stop user enumeration wordpress
<?php
if (!is_admin()) {
// default URL format
if (preg_match('/author=([0-9]*)/i', $_SERVER['QUERY_STRING'])) die(); add_filter('redirect_canonical', 'shapeSpace_check_enum', 10, 2);
}
function shapeSpace_check_enum($redirect, $request) {
// permalink URL format
if (preg_match('/\?author=([0-9]*)(\/*)/i', $request)) die(); else return $redirect;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment