G
(@gnetworkau)
Yes you can simply delete the files.
I don’t do it via php, but you can, check here.
For clearing cache of individual pages, sites, or entire cache – when needing to refresh content – I use cronjobs. Commands like these will do the job:
Clear entire cache
rm -rf /full/path/to/wp-content/cache/supercache >/dev/null 2>&1
Clear cache of one site
rm -rf /full/path/to/wp-content/cache/supercache/domain.com >/dev/null 2>&1
Clear cache single page
rm -rf /full/path/to/wp-content/cache/supercache/domain.com/some-url >/dev/null 2>&1
NOTE: Make sure to use the full path
Added >/dev/null 2>&1 at end of command to stop feedback from cron
There is similar question – https://github.com/Automattic/wp-super-cache/issues/628.
Other solution is wp-cli and package wp-super-cache-cli. You can use this command: wp super-cache flush
I often use wp-cli and I’m contributor for wp-super-cache-cli. It’s very useful tool. If you find new issue then please report and I’ll try to fix it.