WordPress - Bypass W3 Total Cache when running php script in command line
If your wordpress site's using W3 Total Cache, there is a big chance that your php script will stop working because of the cache, especially db cache. Here is my solution for that: Flush W3 Total Cache cache before running any functions. You simply put this line of code before executing any wordpress's function: if (function_exists('w3tc_dbcache_flush')) { w3tc_dbcache_flush(); } For example: ... // Flush W3TC DB cache before creating blog if (function_exists('w3tc_dbcache_flush')) { w3tc_dbcache_flush(); } $blog_id = wpmu_create_blog('my.multisite.blog', $path, $title, $user_id, $meta); ...