Created
March 1, 2021 03:50
-
-
Save amilabandara/ae9ef9c155d26c0d29d2528a86738ff0 to your computer and use it in GitHub Desktop.
Stop user enumeration wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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