简体   繁体   English

"删除缓存 Wordpress"

[英]Delete cache Wordpress

I have a WordPress website, I work to it on local (some CSS fix), but when I deploy it to real server, changes aren't display.我有一个 WordPress 网站,我在本地工作(一些 CSS 修复),但是当我将它部署到真实服务器时,不会显示更改。 If I visit website in private navigation, no problem.如果我在私人导航中访问网站,没问题。 But without private mode, the old css is called.但是如果没有私有模式,就会调用旧的 css。

How can I force to refresh the cache browser for user and use the news css file ?如何强制刷新用户的缓存浏览器并使用新闻 css 文件? I try WP Fastest Cache and some other, but they don't work.我尝试了 WP Fastest Cache 和其他一些,但它们不起作用。

(Sorry for my english) (对不起我的英语不好)

we have 3 type of cache:我们有 3 种类型的缓存:

  1. browser cache浏览器缓存
  2. server cache服务器缓存
  3. site cache站点缓存

cache plugins can clear server and site cache but they can't clear browser cache directly.缓存插件可以清除服务器和站点缓存,但不能直接清除浏览器缓存。 only browser can manage browser cache.只有浏览器可以管理浏览器缓存。

the only way to clear browser cache for all users is versioning or renaming the static files that browsers cache them before.为所有用户清除浏览器缓存的唯一方法是版本控制或重命名浏览器之前缓存它们的静态文件。

take a look at wp_enqueue_script and wp_enqueue_style documents .看看wp_enqueue_scriptwp_enqueue_style文档。 they have a version parameter.他们有一个版本参数。 you can change the version each time you did a change to the file and browsers will get the new version for all users.您可以在每次更改文件时更改版本,浏览器将为所有用户获取新版本。

WP Fastest Cache插件仪表板导航菜单选项WPFC删除缓存和Ctrl+F5截图仪表板

我解决了重命名function.php中的css文件

You need add version for file like您需要为文件添加版本,例如

filename.css?v=12
filename.js?v=12

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM