Skip to content

Instantly share code, notes, and snippets.

@warderer
Created May 22, 2022 15:35
Show Gist options
  • Select an option

  • Save warderer/c75eeb24e933ea20dadaaf8900be9c91 to your computer and use it in GitHub Desktop.

Select an option

Save warderer/c75eeb24e933ea20dadaaf8900be9c91 to your computer and use it in GitHub Desktop.
[Wordpress Enhanced Security] Small tweaks via functions.php to improve wordpress security. #wordpress #security
# disabling PHP file execution in directories where it’s not needed such as /wp-content/uploads/
<Files *.php>
deny from all
</Files>
# Disable file indexing
Options -Indexes
# Disable Login Hints for a Generic Error Message
# Source: https://www.wpbeginner.com/wp-tutorials/11-vital-tips-and-hacks-to-protect-your-wordpress-admin-area/
function no_wordpress_errors(){
return 'Something is wrong!';
}
add_filter( 'login_errors', 'no_wordpress_errors' );
# Disable the function responsible of showing the WP version in generator and rss
# Source: https://www.wpbeginner.com/wp-tutorials/the-right-way-to-remove-wordpress-version-number/
function wp_remove_version() {
return '';
}
add_filter('the_generator', 'wp_remove_version');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment