Are you a frontend developer?
您是前端开发人员吗?
Do you want to clear browser cache for all users?
您是否要为所有用户清除浏览器缓存?
Just activate this plugin and show your work!
只需激活此插件并展示您的作品即可! p>
Disable Version Caching allows you to update the assets version of all CSS and JS files automatically or manually in one click.
“禁用版本缓存”使您可以自动或一键式更新所有CSS和JS文件的资产版本。 p>
Now you can show the latest changes on the site without asking the client to clear the cache.
现在,您可以显示网站上的最新更改,而无需要求客户端清除缓存。 p>
How it works?
它如何工作? h4>
Usually, WordPress loads assets using query param “ver” in the URL (e.g., style.css?ver=4.9.6).
通常,WordPress使用URL中的查询参数“ ver”来加载资产(例如,style.css?ver = 4.9.6)。
It allows browsers to cache these files until the parameter will not be updated.
它允许浏览器缓存这些文件,直到不会更新参数为止。 p>
To prevent caching of CSS and JS files, this plugin adds a unique number (eg, 1526903434) to the “ver” parameter (eg, style.css?ver=4.9.6.1526903434) for all links, loaded using wp_enqueue_style and
为防止缓存CSS和JS文件,此插件为所有链接(使用wp_enqueue_style和)加载了一个唯一编号(例如1526903434)到“ ver”参数(例如style.css?ver = 4.9.6.1526903434)。
wp_enqueue_script functions.
wp_enqueue_script函数。 p>
For developers
面向开发人员 h4>
By default, this plugin updates all assets files every time a user loads a page and adds options in the admin panel (Settings -> Disable Version Caching) which allows you to configure updating of these files.
默认情况下,此插件在用户每次加载页面时都会更新所有资产文件,并在管理面板(设置->禁用版本缓存)中添加选项,该选项可让您配置这些文件的更新。 p>
But you can also set the version of CSS and JS files programmatically.
但是您还可以通过编程方式设置CSS和JS文件的版本。 p>
Just insert this code in functions.php file of your theme and change the value of assets_version when you need to update assets:
只需将此代码插入您主题的functions.php文件中,并在需要更新资产时更改asset_version的值: p>
disable_version_caching( array( disable_version_caching(array( 'assets_version' => '123'
'assets_version'=>'123'
) );
));
code> pre>