From 5ecbacb691f8766b06e776f28d6d436fd8d0e9d2 Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Thu, 15 Jan 2026 17:02:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E6=B5=8F=E8=A7=88=E5=99=A8HTML=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加移动端缓存控制头,禁止浏览器缓存HTML页面 - 使用 Cache-Control: no-cache, no-store, must-revalidate - 仅对移动端前台页面生效,不影响后台和桌面端 --- functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/functions.php b/functions.php index 8a09d70..ba9618d 100644 --- a/functions.php +++ b/functions.php @@ -9,6 +9,16 @@ * @link https://www.gnu.org/licenses/gpl-3.0.html */ +// 禁止移动端浏览器缓存 HTML 页面 +function argon_prevent_mobile_cache() { + if (wp_is_mobile() && !is_admin()) { + header('Cache-Control: no-cache, no-store, must-revalidate'); + header('Pragma: no-cache'); + header('Expires: 0'); + } +} +add_action('send_headers', 'argon_prevent_mobile_cache'); + if (version_compare( $GLOBALS['wp_version'], '4.4-alpha', '<' )) { echo "
" . __("Argon 主题不支持 Wordpress 4.4 以下版本,请更新 Wordpress", 'argon') . "
"; }