Static WordPress Community

Deleting deploy cache

from user:

My colleague told me sometimes some images do not get updated.

To fix this they delete the deploy cache before starting a deploy.

We have now allowed some editors to do a deploy (we made them administrators).

I think that they might forget to click the ‘Delete deploy cache’ button so I would like to automate it.

Can I use the statichtmloutput_post_deploy_trigger action to do it.

Could I wrote a function like:

$controller = StaticHTMLOutput\Controller::getInstance();

$controller->delete_deploy_cache();

Good question!

For WP_CLI usage, we have wp statichtmloutput deploy_cache delete (add --force to not be prompted to confirm)

With latest release from GitHub:

You should be able to call the static method directly, DeployCache::truncate()

If you put that in the statichtmloutput_post_deploy_trigger hook, it will clear it after each deploy, which should be fine. There really needs to be a more useful earlier hook, ie at end of crawl, please file a new issue to request that on GitHub and will add it in.