<?php
/*
Theme Name: Betheme Child
Theme URI: https://themes.muffingroup.com/betheme
Author: Muffin group
Author URI: https://muffingroup.com
Description: Child Theme for Betheme
Template: betheme
Version: 2.0.2
*/

// SÉCURITÉ WORDPRESS
// Masquer version WordPress  
remove_action('wp_head', 'wp_generator');

// Protection spam basique
function add_honeypot_field() {
    echo '<input type="text" name="website_url" style="display:none !important" tabindex="-1" autocomplete="off">';
}
add_action('wp_login_form', 'add_honeypot_field');

// Limitation tentatives de connexion
function limit_login_attempts() {
    $ip = $_SERVER['REMOTE_ADDR'];
    $attempts = get_transient('failed_login_' . $ip) ?: 0;
    
    if ($attempts >= 3) {
        wp_die('IP bloquée 1h après 3 tentatives échouées');
    }
}

function track_failed_login($username) {
    $ip = $_SERVER['REMOTE_ADDR'];
    $attempts = get_transient('failed_login_' . $ip) ?: 0;
    set_transient('failed_login_' . $ip, $attempts + 1, 3600);
}
add_action('wp_login_failed', 'track_failed_login');
add_action('wp_authenticate_user', 'limit_login_attempts');

// Désactiver XML-RPC (faille sécuritaire)
add_filter('xmlrpc_enabled', '__return_false');

// Supprimer informations sensibles
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'rsd_link');
?>