2

I don't normally work in wordpress, having hard time finding a lot of things.

I added one line of custom php to a template file in child theme, and i forgot a semi colon. Now the site will not load and is stuck loading forever. Most of the time when this happens to me in Drupal, i simply re-save the file and refresh; wordpress doesn't work like this apparently..

Where is the default Wordpress caching saved and which file(s) do I remove/edit to force WP to clear it's caches? I cannot access the website whatsoever, it wont load. The only access i have is FTP. If I cannot just delete the cache, what options do I have in the current situation im in?

5
  • WordPress does not have built in page caching, so you will need to identify the caching plugin used and research from there. This is a highly localized problem though. Having no access to the dashboard and editing files directly on the server is really just a recipe for disaster. – Dave Romsey Sep 16 '16 at 21:50
  • @DaveRomsey I have a backup and it seems there is no caching plugin in the plugin list, so by default wordpress doesn't cache anything? what can I do to resolve this? A php typo in a template file can lead to a unrecoverable error? that sounds like a completely broken critical bug. Is there like a fail-safe if this typo was entered in the backend editor? – Altef four Sep 16 '16 at 21:57
  • Right, WordPress core does not do page caching. Try removing the child theme temporarily using FTP, fix the issue in the template (which may not have been saved in the first place), then add the child theme back. You are going to need to access the admin area to set the child theme back to the active theme. Since you don't have access, you could just go into the child theme and make sure that your fix was saved because I'm getting the impression you edited the theme through the theme editor in the back end (originally I thought you used FTP for that too). – Dave Romsey Sep 16 '16 at 22:07
  • I removed the child theme and then put it back on FTP and everything is working now. Super confused. No i was just wondering if I were to theoretically to put the same typo i did in the backend instead of editing it via ftp, would it blow up the same way? And I choose not to edit with the back-end editor on wordpress because it's super slow and laggy, and i need syntax highlighting, and some files I need to edit (poorly hardcoded php files in premium theme) are not seen by the editor in wordpress, need FTP access. – Altef four Sep 16 '16 at 22:31
  • Yes, presumably you'd run into the same problem if there was a fatal error in the theme edited via FTP. Personally, I disable the theme and plugin editors because using them is just asking for trouble. I've added fix I suggested as an answer. Please accept it if it indeed fix the issue (keeps WPSE clean). – Dave Romsey Sep 17 '16 at 1:46
2

WordPress has no native page source output caching. In vanilla installation changes to templates should show up immediately.

If that doesn't happen there are several possible reasons:

  • there is static page cache plugin installed, which serves stale version (the specific implementation of cache would depend on a plugin);
  • there is a caching layer between the site and internet, such as reverse proxy provided by hosting;
  • site has HTTP headers configured in a way that causes browser (or possibly proxy server in route) to cache overly aggressively;
  • PHP has opcode cache installed (which is good/normal) and is configured to cache it aggressively/longer (uncommon), which might cause it to ignore PHP source changes in file for a while.
2
  • To add, I don't think that error pages are using an http 200 code (or at least they should not do that), and therefor no caching should have been done of the error page. OTOH PHP 5.6 (?) introduce caching of the parsed PHP code and because some server failure on configuration the change in the file was not detected and re-parsing didn't happen – Mark Kaplun Sep 17 '16 at 18:16
  • I have added opcode cache as possible reason. – Rarst Sep 17 '16 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.