25 lines
804 B
PHP
25 lines
804 B
PHP
<?php
|
|
/**
|
|
* Hardened Security Native untuk Tema EduKarsa
|
|
* Menangani HTTP Headers aman dan pencegahan enumerasi pengguna
|
|
*/
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
function edukarsa_send_security_headers() {
|
|
if ( ! is_admin() ) {
|
|
header( 'X-Content-Type-Options: nosniff' );
|
|
header( 'X-Frame-Options: SAMEORIGIN' );
|
|
header( 'X-XSS-Protection: 1; mode=block' );
|
|
header( 'Referrer-Policy: strict-origin-when-cross-origin' );
|
|
}
|
|
}
|
|
add_action( 'send_headers', 'edukarsa_send_security_headers' );
|
|
|
|
function edukarsa_block_author_enumeration() {
|
|
if ( ! is_admin() && isset( $_REQUEST['author'] ) && ! empty( $_REQUEST['author'] ) ) {
|
|
wp_safe_redirect( home_url(), 301 );
|
|
exit;
|
|
}
|
|
}
|
|
add_action( 'template_redirect', 'edukarsa_block_author_enumeration' );
|