可能是由于 Cloudflare 缓存了加密文章的内容导致的。您可以尝试通过以下方法解决这个问题:

  1. 在 Cloudflare 的设置中将缓存时间设置为 0,以禁用缓存功能。

  2. 在 WordPress 的设置中将加密文章的缓存时间设置为 0,以禁用缓存功能。

  3. 在 WordPress 的设置中添加以下代码,以防止缓存加密文章:

add_filter( 'wp_headers', function( $headers ) {
if ( ! is_singular() ) {
return $headers;
}
$post_id = get_queried_object_id();
if ( ! post_password_required( $post_id ) ) {
return $headers;
}
$headers['Cache-Control'] = 'private, no-cache, no-store, max-age=0';
$headers['Expires'] = 'Wed, 11 Jan 1984 05:00:00 GMT';
$headers['Pragma'] = 'no-cache';
return $headers;
});

这将防止 Cloudflare 缓存加密文章,同时允许其他文章被缓存。


原文地址: https://www.cveoy.top/t/topic/nLif 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录