I have an issue with Wordpress development that I'm sure is a relatively new occurence.

I am on Mac osx sierra 10.12.3. I'm using MAMP PRO 4.1.1. I'm on Chrome 58.0.3029.110 (64 bit).

If I make a change in code for example search.php. Then go back to the browser and refresh it, it often doens't pick up the change, even with multiple refreshes. I have to wait for around 15 seconds for the change to be picked up.

I've tried:

  • doing a hard refresh in chrome
  • using cache killer plugin
  • opening in a new tab
  • different browser firefox
  • WP_CACHE setting to false

In firefox, at first it seems I can make changes which will be picked up immediately until there is an error and then it gets caught on that and I have to wait a while until it picks up a change to fix the error.

However, overall I think the behaviour is the same, which is confusing. It makes me think there is some Wordpress cache I don't know about (I'm not using any caching plugin and cache is off).

Any idea as this is slowly down my development workflow.

UPDATE: Might be something to do with https://stackoverflow.com/questions/19073270/stop-caching-for-php-5-5-3-in-mamp

  • It may help to use Chrome in Incognito mode (control-shift-N) or a hard refresh (control-F5 instead of just F5). If the changes are CSS or JS, they're a bugger sometimes. Make sure to enqueue them using an automatic filemtime version ( wordimpress.com/wordpress-css-and-js-cache-busting ). – WebElaine May 26 '17 at 14:12
  • @WebElaine I appreciate your help. I am seeing the same problem in firefox and it is php code. – Andrew Welch May 26 '17 at 15:45
  • Have you tried turning wp_debug on? – WebElaine May 30 '17 at 14:10
  • It is turned on. – Andrew Welch May 30 '17 at 15:26
  • Any visible errors/warnings/notices? – WebElaine May 30 '17 at 18:31

The problem was to do with MAMP turning on OPCache by default:

https://stackoverflow.com/questions/19073270/stop-caching-for-php-5-5-3-in-mamp

  • there is nothing wrong with opcode cache on by default and the newer PHP versions will have it on. What you need to look for is the php.ini settings for the duration the files are cached. – Mark Kaplun Jun 12 '17 at 16:13
  • it isn't of use to me for development. – Andrew Welch Jun 12 '17 at 16:14
  • you prefer to develop and test code slower? don't get the last comment – Mark Kaplun Jun 12 '17 at 16:16
  • Have a read of the stack overflow post above. For me, having OPCache on means that I change code, refresh the page, nothing changes. I wait 10 seconds or so and refresh, then it works. For my dev environment I don't need this feature. – Andrew Welch Jun 12 '17 at 17:19
  • php 5.6+ comes with opcode cache "on". I can't imagine that anyone bothers to turn it off. If the default settings in MAMP are unreasonable you should complain. (IIRC it used to be 2 seconds which is reasonable for human in the old APC) – Mark Kaplun Jun 12 '17 at 17:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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