Support » Plugin: WP Super Cache » Clear cache programmatically

  • For one of our websites we import data via a php script. Depending on the import, we need to manually clear the entire cache, or selected pages only.

    Is there a way to do this, preferably directly in php (without WordPress interfaces)?
    Is it sufficient to simply delete (some) files?

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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

    Saša

    (@stodorovic)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Clear cache programmatically’ is closed to new replies.