{"id":2673,"date":"2025-03-21T11:35:06","date_gmt":"2025-03-21T02:35:06","guid":{"rendered":"https:\/\/cooss.net\/how-to-delete-wp-rocket-cache\/"},"modified":"2025-03-21T11:35:06","modified_gmt":"2025-03-21T02:35:06","slug":"how-to-delete-wp-rocket-cache","status":"publish","type":"post","link":"https:\/\/cooss.net\/en\/how-to-delete-wp-rocket-cache\/","title":{"rendered":"How to delete WP-Rocket cache"},"content":{"rendered":"\n<p>When cached with WP-Rocket, there are times when you need to delete the cache of a specific page or post. This is because, when the content of the post changes, the Archive pages where this post is displayed also need to be updated.<\/p>\n\n\n\n<p>Of course, if you modify it in the WordPress editor, the cached content will be automatically refreshed, so usually there is no need to worry about this. However, if the content has been changed by modifying it with a custom function in functions.php or directly in the database, the plugin may not recognize the change, and the previously cached content may still be displayed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">WP-Rocket Menu<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Delete All Cache<\/h4>\n\n\n\n<p>It would be simple to delete all cache from the WP-Rocket menu on the admin page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"189\" height=\"92\" src=\"https:\/\/cooss.net\/wp-content\/uploads\/2025\/03\/image-4.png\" alt=\"\" class=\"wp-image-2658\" title=\"\"><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Delete Page Cache<\/h4>\n\n\n\n<p>After logging into the admin, when you display the corresponding page, you can use the menu to delete the current page cache from the top admin menu.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Admin Page<\/h3>\n\n\n\n<p>To delete just one post or one page, you can do so from the post or page list as shown in the image below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"663\" height=\"161\" src=\"https:\/\/cooss.net\/wp-content\/uploads\/2025\/03\/image-3.png\" alt=\"\" class=\"wp-image-2652\" title=\"\" srcset=\"https:\/\/cooss.net\/wp-content\/uploads\/2025\/03\/image-3.png 663w, https:\/\/cooss.net\/wp-content\/uploads\/2025\/03\/image-3-300x73.png 300w, https:\/\/cooss.net\/wp-content\/uploads\/2025\/03\/image-3-600x146.png 600w\" sizes=\"(max-width: 663px) 100vw, 663px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Delete During Programming<\/h3>\n\n\n\n<p>To ensure that the cache is also updated when modifying a post during programming tasks, you can use coding like the one below.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">REST API<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -X GET \"https:\/\/yourwebsite.com\/wp-json\/wp-rocket\/v1\/purge?url=https:\/\/yourwebsite.com\/sample-page\" \n     -H \"Authorization: Bearer YOUR_API_KEY\"\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Change the <code>https:\/\/yourwebsite.com\/sample-page<\/code> part to the URL of the page you want to delete.<\/li>\n\n\n\n<li><code>YOUR_API_KEY<\/code> is the WP Rocket API key.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">PHP<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>if ( function_exists( 'rocket_clean_post' ) ) {\n    rocket_clean_post( 123 ); \/\/ 123 is the ID of the page to be deleted\n}\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When cached with WP-Rocket, there are times when you need to delete the cache of a specific page or post. This is because, when the content of the post changes, the Archive pages where this post is displayed also need to be updated. Of course, if you modify it in the WordPress editor, the cached [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[146],"tags":[],"class_list":["post-2673","post","type-post","status-publish","format-standard","hentry","category-wp-rocket-en"],"_links":{"self":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/posts\/2673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/comments?post=2673"}],"version-history":[{"count":0,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/posts\/2673\/revisions"}],"wp:attachment":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/media?parent=2673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/categories?post=2673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/tags?post=2673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}