Last active
December 1, 2025 20:48
-
-
Save nathaningram/18ee62f800a3334f3f384533e246ef4d to your computer and use it in GitHub Desktop.
Starter Site 2025 - MU Security
This file contains hidden or 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 | |
| /* | |
| Plugin Name: Custom Security Functions | |
| Description: Customized WP Security | |
| Version: 1.0 | |
| Plugin URI: https://wpnathan.com | |
| Author: Nathan Ingram | |
| Author URI: https://wpnathan.com | |
| License: GPL2 | |
| */ | |
| // Security Check | |
| if (!defined('ABSPATH')) { | |
| die(); | |
| } | |
| // Suppress Login Errors | |
| function ni_suppress_login_errors(){ | |
| return 'Something went wrong - please check your username or password'; | |
| } | |
| add_filter('login_errors', 'ni_suppress_login_errors'); | |
| // Prevent User Enumeration | |
| function ni_stop_author_enumeration($redirect, $request) { | |
| if (preg_match('/author=([0-9]*)(\/*)/i', $request)) { | |
| wp_redirect(home_url(), 301); | |
| exit; | |
| } | |
| return $redirect; | |
| } | |
| add_filter('redirect_canonical', 'ni_stop_author_enumeration', 10, 2); | |
| // Disable Post by Email | |
| add_filter( 'enable_post_by_email_configuration', '__return_false', 100 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment