WordPress Development Asked by J.BizMai on October 30, 2021
As developer, you want all the time the last version files on page refresh action.
As I understood, there are 3 kinds of cache :
For some reasons, there are some days where I can removed browser cache, download a new browser on WordPress project without any cache plugin…
If I keypress F5, CTRL+F5 or CTRL+Shift+R, I got an old version, sometimes version older.
I can loose hours like this.
One friend told me to see about the proxy cache and force the HTTP Header to get the last files version.
I got this raw header :
GET /preprod/sign-up/ HTTP/2
Host: mysite.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: ...
DNT: 1
Connection: keep-alive
Cookie: wordpress_test_cookie=WP+Cookie+check; bid_1_password_protected_auth=1111111111111111111111; SERVERID123456=1234
Upgrade-Insecure-Requests: 1
Pragma: no-cache
Cache-Control: no-cache
Questions :
I found a solution here.
function add_header_no_cache($headers) {
$headers['Cache-Control'] = 'no-cache, no-store, must-revalidate, max-age=0';
$headers['Pragma'] = 'no-cache';
$headers['Expires'] = '0';
return $headers;
}
add_filter( 'wp_headers', 'add_header_no_cache_login' );
Answered by J.BizMai on October 30, 2021
If it's browser cache, you can go into the dev tools and disable all local cache. Browser docs can tell you how to do this.
If it's the proxy cache, either turn it off or load the site without the proxy, and retest. You will need to consult the documentation for the proxy you're using for how to do this, and how to fix it. You would be better asking on another stack about your specific proxy software and its configuration.
If it's the WP cache, then no, WP doesn't have a page cache. Either disable the plugins providing caching and retest, or consult with their documentation. The solution here will be plugin specific, there is no generic WP solution as there is noo generic WP page caching.
Either start with browser cache and work by peeling away the layers in a process of elimination. Or, by eliminating all of it, and turning it back on 1 layer at a time until the misbehaviour returns. This will give you useful information on how to debug the problem and which layer is problematic.
Answered by Tom J Nowell on October 30, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP