Files
acrib.es/wp-content/mu-plugins/acrib-core.php
Malin 6daabcab65 feat: caching, optimization, legal pages & footer
- WP Super Cache enabled (PHP mode, gzip, Nginx compatible)
- Autoptimize: CSS/HTML minification + deferred JS + Google Fonts optimization
- Cookie Notice: GDPR/LOPD banner styled with brand colors (navy/burgundy/gold)
- Legal pages: Aviso Legal, Política de Privacidad, Política de Cookies (ES)
- MU-plugin: custom footer with legal links + Cloud Host credit
- Footer: copyright, legal nav, Hosted & Maintained by Cloud Host (cloudhost.es)
- Security: X-Frame-Options, X-Content-Type, Referrer-Policy headers
- Security: XML-RPC disabled, REST user enumeration blocked
- Performance: emoji scripts removed, post revisions limited to 3
2026-05-19 19:58:11 +02:00

69 lines
2.5 KiB
PHP

<?php
/**
* ACRIB Core MU-Plugin
* Always-on: custom footer, security hardening, performance tweaks.
* @version 1.0
*/
// --- Footer: bottom bar with legal links + Cloud Host credit ---
add_action('wp_footer', function () {
$year = date('Y');
$legal_url = home_url('/aviso-legal/');
$pp_url = home_url('/politica-privacidad/');
$cookie_url = home_url('/politica-cookies/');
?>
<div class="acrib-footer-bottom">
<div class="acrib-footer-bottom-inner">
<p class="acrib-footer-copyright">
&copy; <?php echo $year; ?> <strong>ACRIB</strong> &mdash; Asociaci&oacute;n Casa Rom&acirc;neasc&#259; de las Islas Baleares
</p>
<ul class="acrib-footer-legal-links">
<li><a href="<?php echo esc_url($legal_url); ?>">Aviso Legal</a></li>
<li><a href="<?php echo esc_url($pp_url); ?>">Privacidad</a></li>
<li><a href="<?php echo esc_url($cookie_url); ?>">Cookies</a></li>
</ul>
<p class="acrib-footer-hosted">
Hosted &amp; Maintained by <a href="https://cloudhost.es" target="_blank" rel="noopener noreferrer">Cloud Host</a>
</p>
</div>
</div>
<?php
}, 100);
// --- Security headers ---
add_action('send_headers', function () {
if (!is_admin()) {
header('X-Frame-Options: SAMEORIGIN');
header('X-Content-Type-Options: nosniff');
header('Referrer-Policy: strict-origin-when-cross-origin');
header('Permissions-Policy: camera=(), microphone=(), geolocation=()');
}
});
// --- Disable XML-RPC ---
add_filter('xmlrpc_enabled', '__return_false');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wp_shortlink_wp_head');
// --- Disable REST API user enumeration ---
add_filter('rest_endpoints', function ($endpoints) {
unset($endpoints['/wp/v2/users'], $endpoints['/wp/v2/users/(?P<id>[\d]+)']);
return $endpoints;
});
// --- Disable emoji (reduces ~20KB page weight) ---
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('admin_print_styles', 'print_emoji_styles');
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
// --- Limit post revisions ---
if (!defined('WP_POST_REVISIONS')) {
define('WP_POST_REVISIONS', 3);
}