WordPress flush cache programatically

How to flush cache in WordPress programatically?

  1. Create "cache_clear.php" file in WordPress directory.
  2. Add following code
<?php
require __DIR__ . '/wp-load.php';
echo 'clearing';
var_dump(wp_cache_flush());
echo 'cleared';
?>
  1. If you have access to SSH - run php cache_clear.php
  2. Open this page in the browser WEBSITE_URL/cache_clear.php
  3. After you've finished please remember to delete this file.

Check out my hassle-free WordPress hosting and WordPress Maintenance Plans