{"id":5331392,"date":"2014-09-25T19:16:32","date_gmt":"2014-09-25T19:16:32","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/clearing-the-cache-from-an-external-php-script\/"},"modified":"2016-08-22T02:52:00","modified_gmt":"2016-08-22T02:52:00","slug":"clearing-the-cache-from-an-external-php-script","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/clearing-the-cache-from-an-external-php-script\/","title":{"rendered":"Clearing the cache from an external PHP script"},"content":{"rendered":"<p>Hi, I&#8217;d like to clear the W3tc cache via an external php script.<\/p>\n<p>My understanding is that this should work. In fact, it works when WP Super Cache is enabled, but not when W3TC is enabled. <\/p>\n<p>Any pointers?<\/p>\n<pre><code>define( &#039;WP_USE_THEMES&#039;, false );\nrequire(&#039;wp-blog-header.php&#039;);\n\n\tif ( function_exists(&#039;w3tc_pgcache_flush&#039;) ) {\n\t\tw3tc_pgcache_flush();\n\t} else if ( function_exists(&#039;wp_cache_clear_cache&#039;) ) {\n\t\twp_cache_clear_cache();\n\t\t}<\/code><\/pre>\n<p>https:\/\/wordpress.org\/plugins\/w3-total-cache\/<\/p>\n","protected":false},"template":"","class_list":["post-5331392","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5331392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5331392\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5331392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}