Support » Plugin: Cloudflare » Automatic Cache Management and Large Custom Menus

  • It seems that the Automatic Cache Management option can cause some problems when large custom navigation menus are being edited due to the way those items are updated. We were getting timeouts when editing a menu with a large number of items and having ACM activated, but upon deactivation, were not experiencing the timeouts. Perhaps you can do something to handle the ACM flush differently when custom menus are updated. For now we are just leaving ACM deactivated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @ekyle,

    We hook on these actions for ACM:

    Do you know which hook is triggering the time out?
    Are there any errors in the PHP error log?
    Are you able to provide us with sample arguments being passed to those hooks so we can try to reproduce and debug?


    Most likely it is on the edit_post action since each menu item is a post and updating the menu item causes each to be updated as well. Here are the relevant functions associated with a menu update.


    The last, wp_insert_post, executes the edit_post action. So it would seem that’s where the inefficiency may be. Granted, I have not delved into the CloudFlare plugin code so I could be mistaken as to the cause.

    There are no errors, just the timeout.

    The menu in question has 600 items. Without ACM active, it saves in under 12 seconds, but with ACM, it exceeds the time allowed for script execution on the server.

    As an alternative to disabling ACM all the time, we can just disable it during menu edits. I hope this information helps.

    Hi @ekyle,

    In …/plugins/Cloudflare folder there is a file named config.js. Could you edit that file and make debug: true

    then try to activate edit_post hook by editing a post?

    In your PHP error logs you should see something like “List of URLs purged are…”

    If you can please tell us how many items are in there.


    There are only 24 items in the purged URLs array and appears that the purge cache succeeds based on the message “DEBUG:purgeCacheByRevelantURLs succeeded”.

    However, the menu never finishes saving and a 502 error is generated. The 502 error is caused by the host stopping the script from exceeding a threshold of time, so technically the problem is not caused by the CloudFlare plugin, but the environment it is in.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Automatic Cache Management and Large Custom Menus’ is closed to new replies.