{"id":522,"date":"2022-07-15T18:30:25","date_gmt":"2022-07-15T16:30:25","guid":{"rendered":"https:\/\/astuces-wp.com\/?p=522"},"modified":"2024-07-25T16:43:54","modified_gmt":"2024-07-25T14:43:54","slug":"auto-purge-cache-after-plugins-updated","status":"publish","type":"post","link":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/","title":{"rendered":"Auto-purge cache after plugins updated"},"content":{"rendered":"<p>It is quite common to have CSS or JS problems after updating plugins when you keep a cache solution to increase its speed.<\/p>\n<h2>Auto purge WordPress cache<\/h2>\n<p>As part of my professional activity in the Whodunit agency, we have developed a micro plugin that automatically deletes the cache on a plugin update. Compatible with plugins:<\/p>\n<ul>\n<li><strong>Wp-Rocket<\/strong> in three steps:\n<ul>\n<li>cache purge,<\/li>\n<li>removal of minified CSS &amp; JS data,<\/li>\n<li>and reload the cache via sitemap<\/li>\n<\/ul>\n<\/li>\n<li><strong>WPEngine<\/strong><\/li>\n<li><strong>W3 Total Cache<\/strong><\/li>\n<li><strong>SiteGround<\/strong><\/li>\n<\/ul>\n<pre>&lt;?php \r\n<span style=\"color: #00ff00;\">\/**\r\n* Plugin Name: MyWP Auto-purge Rocket Cache\r\n* Description: This plugin processes automatic cache purge\/preload and JS\/CSS minification when plugins are updated.\r\n* Author: Magali\r\n* Author URI: https:\/\/magali-colas.fr\r\n* Version: 0.1\r\n* License: GNU General Public License v3 or later\r\n* License URI: http:\/\/www.gnu.org\/licenses\/gpl-3.0.html\r\n*\/<\/span>\r\nif ( ! defined( 'ABSPATH' ) ) {\r\nexit;\r\n}\r\n\r\nfunction mc_auto_purge_rocket_cache( $upgrader_object, $options ) {\r\n\r\n<span style=\"color: #00ff00;\">\/\/ Begin Rocket \r\n\/\/ Purge Rocket cache<\/span>\r\nif ( function_exists( 'rocket_clean_domain' ) ) {\r\nrocket_clean_domain();\r\n}\r\n<span style=\"color: #00ff00;\">\/\/ Clear minified CSS and JavaScript files.<\/span>\r\nif ( function_exists( 'rocket_clean_minify' ) ) {\r\nrocket_clean_minify();\r\n}\r\n<span style=\"color: #00ff00;\">\/\/ Preload cache.<\/span>\r\nif ( function_exists( 'run_rocket_sitemap_preload' ) ) {\r\nrun_rocket_sitemap_preload();\r\n}\r\n<span style=\"color: #00ff00;\">\/\/ End rocket<\/span>\r\n\r\n<span style=\"color: #00ff00;\">\/\/ wp-super-cache<\/span>\r\nif ( function_exists( 'wp_cache_clear_cache' ) ) {\r\nwp_cache_clear_cache();\r\n}\r\n\r\n<span style=\"color: #00ff00;\">\/\/ WPEngine<\/span>\r\nif ( class_exists( 'WpeCommon' ) ) {\r\nWpeCommon::purge_memcached();\r\nWpeCommon::clear_maxcdn_cache();\r\nWpeCommon::purge_varnish_cache();\r\n}\r\n\r\n<span style=\"color: #00ff00;\">\/\/ w3 total cash<\/span>\r\nif ( function_exists( 'w3tc_pgcache_flush' ) ) {\r\nw3tc_pgcache_flush();\r\n}\r\n\r\n<span style=\"color: #00ff00;\">\/\/ siteground<\/span>\r\nif ( function_exists( 'sg_cachepress_purge_cache' ) ) {\r\nsg_cachepress_purge_cache();\r\n}\r\n\r\n}\r\nadd_action( 'upgrader_process_complete', 'mc_auto_purge_rocket_cache', 10, 2);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It is quite common to have CSS or JS problems after updating plugins when you keep a cache solution to increase its speed. Auto purge WordPress cache As part of my professional activity in the Whodunit agency, we have developed a micro plugin that automatically deletes the cache on a plugin update. Compatible with plugins: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":527,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[52],"class_list":["post-522","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-hook"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to auto-purge cache after plugins updated ?<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to auto-purge cache after plugins updated ?\" \/>\n<meta property=\"og:description\" content=\"It is quite common to have CSS or JS problems after updating plugins when you keep a cache solution to increase its speed. Auto purge WordPress cache As part of my professional activity in the Whodunit agency, we have developed a micro plugin that automatically deletes the cache on a plugin update. Compatible with plugins: [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-15T16:30:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-25T14:43:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"525\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Lyanna\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lyanna\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/\"},\"author\":{\"name\":\"Lyanna\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/f7cb41098a46b2339b7bf590e8aa516a\"},\"headline\":\"Auto-purge cache after plugins updated\",\"datePublished\":\"2022-07-15T16:30:25+00:00\",\"dateModified\":\"2024-07-25T14:43:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/\"},\"wordCount\":84,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg\",\"keywords\":[\"Hook\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/\",\"url\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/\",\"name\":\"How to auto-purge cache after plugins updated ?\",\"isPartOf\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg\",\"datePublished\":\"2022-07-15T16:30:25+00:00\",\"dateModified\":\"2024-07-25T14:43:54+00:00\",\"author\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/f7cb41098a46b2339b7bf590e8aa516a\"},\"breadcrumb\":{\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage\",\"url\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg\",\"contentUrl\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg\",\"width\":960,\"height\":525},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud83c\udfe0 Accueil\",\"item\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hook\",\"item\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/tag\/hook\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Auto-purge cache after plugins updated\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/#website\",\"url\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/f7cb41098a46b2339b7bf590e8aa516a\",\"name\":\"Lyanna\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4e361b30ec79a25d91a54b45254a5fd94f2c88bcf72f01c85a103a89bbec68f4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4e361b30ec79a25d91a54b45254a5fd94f2c88bcf72f01c85a103a89bbec68f4?s=96&d=mm&r=g\",\"caption\":\"Lyanna\"},\"sameAs\":[\"https:\/\/astuces-wp.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to auto-purge cache after plugins updated ?","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/","og_locale":"fr_FR","og_type":"article","og_title":"How to auto-purge cache after plugins updated ?","og_description":"It is quite common to have CSS or JS problems after updating plugins when you keep a cache solution to increase its speed. Auto purge WordPress cache As part of my professional activity in the Whodunit agency, we have developed a micro plugin that automatically deletes the cache on a plugin update. Compatible with plugins: [&hellip;]","og_url":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/","article_published_time":"2022-07-15T16:30:25+00:00","article_modified_time":"2024-07-25T14:43:54+00:00","og_image":[{"width":960,"height":525,"url":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg","type":"image\/jpeg"}],"author":"Lyanna","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Lyanna","Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#article","isPartOf":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/"},"author":{"name":"Lyanna","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/f7cb41098a46b2339b7bf590e8aa516a"},"headline":"Auto-purge cache after plugins updated","datePublished":"2022-07-15T16:30:25+00:00","dateModified":"2024-07-25T14:43:54+00:00","mainEntityOfPage":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/"},"wordCount":84,"commentCount":0,"image":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage"},"thumbnailUrl":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg","keywords":["Hook"],"articleSection":["PHP"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/","url":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/","name":"How to auto-purge cache after plugins updated ?","isPartOf":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/#website"},"primaryImageOfPage":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage"},"image":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage"},"thumbnailUrl":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg","datePublished":"2022-07-15T16:30:25+00:00","dateModified":"2024-07-25T14:43:54+00:00","author":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/f7cb41098a46b2339b7bf590e8aa516a"},"breadcrumb":{"@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#primaryimage","url":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg","contentUrl":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-content\/uploads\/2022\/07\/speed_site.jpg","width":960,"height":525},{"@type":"BreadcrumbList","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/auto-purge-cache-after-plugins-updated\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud83c\udfe0 Accueil","item":"https:\/\/magali-colas.fr\/astuces-wordpress\/"},{"@type":"ListItem","position":2,"name":"Hook","item":"https:\/\/magali-colas.fr\/astuces-wordpress\/tag\/hook\/"},{"@type":"ListItem","position":3,"name":"Auto-purge cache after plugins updated"}]},{"@type":"WebSite","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/#website","url":"https:\/\/magali-colas.fr\/astuces-wordpress\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/magali-colas.fr\/astuces-wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Person","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/f7cb41098a46b2339b7bf590e8aa516a","name":"Lyanna","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/magali-colas.fr\/astuces-wordpress\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4e361b30ec79a25d91a54b45254a5fd94f2c88bcf72f01c85a103a89bbec68f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4e361b30ec79a25d91a54b45254a5fd94f2c88bcf72f01c85a103a89bbec68f4?s=96&d=mm&r=g","caption":"Lyanna"},"sameAs":["https:\/\/astuces-wp.com"]}]}},"_links":{"self":[{"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/posts\/522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/comments?post=522"}],"version-history":[{"count":2,"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/posts\/522\/revisions"}],"predecessor-version":[{"id":640,"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/posts\/522\/revisions\/640"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/media\/527"}],"wp:attachment":[{"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/media?parent=522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/categories?post=522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/magali-colas.fr\/astuces-wordpress\/wp-json\/wp\/v2\/tags?post=522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}