Skip to content

Instantly share code, notes, and snippets.

@douglascabral
douglascabral / wp-content-uploads-.htaccess
Created June 25, 2020 14:00
improve security in WP Upload folder
<files *.ini>
order allow,deny
deny from all
</files>
<files *.sh>
order allow,deny
deny from all
</files>
@douglascabral
douglascabral / wordpress-security.htaccess
Last active June 29, 2020 20:29
Improve WP Security
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
RewriteRule (vendor|node_modules) - [R=404,L,NC]
RewriteRule Gruntfile.js - [R=404,L,NC]
RewriteRule gulpfile.js - [R=404,L,NC]
RewriteRule package.json - [R=404,L,NC]
<?php
add_filter( 'rest_endpoints', 'disable_default_endpoints' );
function disable_default_endpoints( $endpoints ) {
$allowed = ['/some/route/here'];
foreach ( $endpoints as $maybe_endpoint => $object ) {
if ( ! in_array($maybe_endpoint, $allowed) ) {