[\d]+)'] ); return $endpoints; } ); /* 4. Stop username enumeration through ?author=N redirects. */ add_action( 'template_redirect', static function () { if ( ! is_user_logged_in() && isset( $_GET['author'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification wp_safe_redirect( home_url( '/' ), 301 ); exit; } } ); /* 5. Same login error whether the username or the password was wrong. */ add_filter( 'login_errors', static function () { return __( 'Incorrect username or password.' ); } ); /* 6. Disable the theme/plugin file editor if wp-config.php didn't already. */ if ( ! defined( 'DISALLOW_FILE_EDIT' ) ) { define( 'DISALLOW_FILE_EDIT', true ); }