Añadir mu-plugins y scripts de feadulta

This commit is contained in:
2026-06-28 15:10:46 -04:00
parent bce7e42f44
commit b6116b066d
106 changed files with 17600 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
/**
* Plugin Name: Fea Avatar Cache-bust (#81)
* Description: Añade ?v=<mtime> a las URLs de avatar servidas desde
* uploads/avatares/autores/autor-<uid>.png. Como al actualizar la foto se
* reescribe el MISMO fichero, sin esto el navegador/Cloudflare siguen sirviendo
* la versión cacheada. Corre tras el filtro de fea-homepage (prioridad 20).
*/
if (!defined('ABSPATH')) exit;
add_filter('get_avatar_url', function ($url, $id_or_email, $args) {
if (!is_string($url) || strpos($url, '/avatares/autores/autor-') === false) return $url;
$rel = preg_replace('~\?.*$~', '', substr($url, strpos($url, '/avatares/')));
$path = wp_get_upload_dir()['basedir'] . $rel;
if (file_exists($path)) $url = add_query_arg('v', filemtime($path), $url);
return $url;
}, 20, 3);