PluginProbe
Powered Cache – Caching and Optimization for WordPress – Easily Improve PageSpeed & Web Vitals Score / 2.0
Powered Cache – Caching and Optimization for WordPress – Easily Improve PageSpeed & Web Vitals Score v2.0
trunk 1.0 1.0.1 1.1 1.1.1 1.1.2 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1 2.1.1 2.1.2 2.2 2.2.1 All 69 releases
← All changes | includes/classes/AdvancedCache.php +56 -329 trunk2.0 View file →
@@ -6,15 +6,13 @@
6 6 */
7 7
8 8 namespace PoweredCache;
9 9
10 -use PoweredCache\Async\CachePurger;
11 10 use const PoweredCache\Constants\POST_META_DISABLE_CACHE_KEY;
12 11 use function PoweredCache\Utils\clean_page_cache_dir;
13 12 use function PoweredCache\Utils\clean_site_cache_dir;
14 13 use function PoweredCache\Utils\delete_page_cache;
15 14 use function PoweredCache\Utils\get_post_related_urls;
16 -use const PoweredCache\Constants\PURGE_CACHE_PLUGIN_NOTICE_TRANSIENT;
17 15
18 16 if ( ! defined( 'ABSPATH' ) ) {
19 17 exit; // Exit if accessed directly.
20 18 }
@@ -26,23 +24,8 @@
26 24 */
27 25 class AdvancedCache {
28 26
29 27 /**
30 - * Holds plugin settings
31 - *
32 - * @var array $settings
33 - */
34 - private $settings;
35 -
36 -
37 - /**
38 - * Instance of CachePreloader
39 - *
40 - * @var CachePurger
41 - */
42 - private $cache_purger;
43 -
44 - /**
45 28 * Return an instance of the current class
46 29 *
47 30 * @return AdvancedCache
48 31 * @since 1.0
@@ -64,31 +47,26 @@
64 47 *
65 48 * @since 1.0
66 49 */
67 50 public function setup() {
68 - $this->settings = \PoweredCache\Utils\get_settings();
51 + $settings = \PoweredCache\Utils\get_settings();
69 52
70 - if ( ! $this->settings['enable_page_cache'] ) {
53 + if ( ! $settings['enable_page_cache'] ) {
71 54 return;
72 55 }
73 56
74 - $this->cache_purger = CachePurger::factory();
75 -
76 57 add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ) );
77 58 add_action( 'admin_post_powered_cache_purge_page_cache', array( $this, 'purge_page_cache' ) );
78 59 add_action( 'admin_post_powered_cache_purge_page_cache_network', array( $this, 'purge_page_cache_network_wide' ) );
79 - add_action( 'transition_post_status', array( $this, 'purge_on_post_update' ), 9999, 3 );
60 + add_action( 'pre_post_update', array( $this, 'purge_on_post_update' ), 10, 1 );
61 + add_action( 'save_post', array( $this, 'purge_on_post_update' ), 10, 1 );
62 + add_action( 'wp_trash_post', array( $this, 'purge_on_post_update' ), 10, 1 );
80 63 add_action( 'switch_theme', array( $this, 'purge_on_switch_theme' ) );
81 - add_action( 'wp_set_comment_status', array( $this, 'purge_post_on_comment_update' ) );
82 - add_action( 'edit_comment', array( $this, 'purge_post_on_comment_update' ) );
64 + add_action( 'wp_set_comment_status', array( $this, 'purge_post_on_comment_status_change' ), 10, 2 );
83 65 add_action( 'set_comment_cookies', array( $this, 'set_comment_cookie' ), 10, 2 );
84 66 add_filter( 'powered_cache_post_related_urls', array( $this, 'powered_cache_post_related_urls' ) );
85 67 add_filter( 'powered_cache_page_cache_enable', array( $this, 'maybe_caching_disabled' ) );
86 68 add_filter( 'powered_cache_mod_rewrite', array( $this, 'maybe_disable_mod_rewrite' ), 99 );
87 - add_action( 'wp_update_site', array( $this, 'purge_on_site_update' ), 10, 2 );
88 - add_action( 'create_term', array( $this, 'purge_on_term_change' ), 10, 3 );
89 - add_action( 'edit_term', array( $this, 'purge_on_term_change' ), 10, 3 );
90 - add_action( 'delete_term', array( $this, 'purge_on_term_change' ), 10, 3 );
91 69 }
92 70
93 71 /**
94 72 * Add purge button on admin bar
@@ -117,19 +95,8 @@
117 95 'href' => wp_nonce_url( admin_url( 'admin-post.php?action=powered_cache_purge_page_cache' ), 'powered_cache_purge_page_cache' ),
118 96 'parent' => 'powered-cache',
119 97 )
120 98 );
121 -
122 - if ( is_singular() && ! is_preview() && is_post_publicly_viewable( get_the_ID() ) ) {
123 - $wp_admin_bar->add_menu(
124 - array(
125 - 'id' => 'advanced-cache-current-page-purge',
126 - 'title' => esc_html__( 'Purge Current Page', 'powered-cache' ),
127 - 'href' => wp_nonce_url( admin_url( sprintf( 'admin-post.php?action=powered_cache_purge_page_cache&type=current-page&post=%d', get_the_ID() ) ), 'powered_cache_purge_page_cache' ),
128 - 'parent' => 'powered-cache',
129 - )
130 - );
131 - }
132 99 }
133 100 }
134 101
135 102
@@ -138,28 +105,20 @@
138 105 *
139 106 * @since 2.0
140 107 */
141 108 public function purge_page_cache_network_wide() {
142 - $nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';
143 - if ( ! wp_verify_nonce( $nonce, 'powered_cache_purge_page_cache_network' ) ) {
109 + if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'powered_cache_purge_page_cache_network' ) ) {
144 110 wp_nonce_ays( '' );
145 111 }
146 112
147 113 if ( current_user_can( 'manage_network' ) ) {
148 - if ( $this->settings['async_cache_cleaning'] ) {
149 - $this->cache_purger->push_to_queue( [ 'call' => 'clean_page_cache_dir' ] );
150 - $this->cache_purger->save()->dispatch();
151 - } else {
152 - clean_page_cache_dir();
153 - }
114 + clean_page_cache_dir();
154 115 $redirect_url = add_query_arg( 'pc_action', 'flush_page_cache_network', wp_get_referer() );
155 116 } else {
156 117 $redirect_url = add_query_arg( 'pc_action', 'flush_page_cache_network_err_permission', wp_get_referer() );
157 118 }
158 119
159 - delete_site_transient( PURGE_CACHE_PLUGIN_NOTICE_TRANSIENT );
160 -
161 - wp_safe_redirect( esc_url_raw( $redirect_url ) );
120 + wp_safe_redirect( $redirect_url );
162 121 exit;
163 122 }
164 123
165 124 /**
@@ -168,107 +127,54 @@
168 127 * @since 1.0
169 128 * @since 1.1 clean site dir instead of root page caching dir
170 129 */
171 130 public function purge_page_cache() {
172 - if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'powered_cache_purge_page_cache' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
131 + if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'powered_cache_purge_page_cache' ) ) {
173 132 wp_nonce_ays( '' );
174 133 }
175 134
176 135 if ( current_user_can( 'manage_options' ) ) {
177 - if ( isset( $_GET['type'] ) && 'current-page' === $_GET['type'] && ! empty( $_GET['post'] ) ) {
178 - $this->purge_post( absint( $_GET['post'] ) );
179 - } elseif ( $this->settings['async_cache_cleaning'] ) {
180 - $this->cache_purger->push_to_queue( [ 'call' => 'clean_site_cache_dir' ] );
181 - $this->cache_purger->save()->dispatch();
182 - } else {
183 - clean_site_cache_dir();
184 - }
185 -
136 + clean_site_cache_dir();
186 137 $redirect_url = add_query_arg( 'pc_action', 'flush_page_cache', wp_get_referer() );
187 138 } else {
188 139 $redirect_url = add_query_arg( 'pc_action', 'flush_page_cache_err_permission', wp_get_referer() );
189 140 }
190 141
191 - delete_transient( PURGE_CACHE_PLUGIN_NOTICE_TRANSIENT );
192 -
193 - wp_safe_redirect( esc_url_raw( $redirect_url ) );
142 + wp_safe_redirect( $redirect_url );
194 143 exit;
195 144 }
196 145
197 146
198 147 /**
199 - * Purge cache when post updated
200 - *
201 - * @param string $new_status New Post status.
202 - * @param string $old_status Old Post status.
203 - * @param \WP_Post $post Post object.
204 - *
205 - * @return void
206 - * @since 3.4 adjusted for `transition_post_status` hook
207 - * @since 1.0
208 - */
209 - public function purge_on_post_update( $new_status, $old_status, $post ) {
210 - if ( 'publish' === $new_status || 'publish' === $old_status ) {
211 - $this->purge_post( $post->ID );
212 - }
213 - }
214 -
215 - /**
216 148 * Purge post related page cache
217 149 *
218 150 * @param int $post_id Post ID
219 151 *
220 - * @since 3.4
152 + * @since 1.0
221 153 */
222 - public function purge_post( $post_id ) {
223 - $current_post = get_post( $post_id );
154 + public function purge_on_post_update( $post_id ) {
155 + $current_post_status = get_post_status( $post_id );
224 156
225 - if ( ! is_a( $current_post, 'WP_Post' ) ) {
226 - return;
227 - }
157 + $urls = array();
228 158
229 - if ( wp_is_post_autosave( $post_id ) || wp_is_post_revision( $post_id ) ) {
230 - return;
231 - }
159 + if ( in_array( $current_post_status, array( 'publish', 'trash' ), true ) ) {
160 + $urls = get_post_related_urls( $post_id );
232 161
233 - if ( ! is_post_type_viewable( $current_post->post_type ) ) {
234 - return;
235 - }
162 + /**
163 + * Page cache purge urls.
164 + *
165 + * @hook powered_cache_advanced_cache_purge_urls
166 + *
167 + * @param {array} $urls The list of URLs that will purged
168 + * @param {int} $post_id Post ID.
169 + *
170 + * @return {array} New value
171 + * @since 1.0
172 + */
173 + $urls = apply_filters( 'powered_cache_advanced_cache_purge_urls', $urls, $post_id );
236 174
237 - if ( ! in_array( $current_post->post_status, array( 'publish', 'private', 'trash', 'pending', 'draft' ), true ) ) {
238 - return;
239 - }
240 -
241 - $urls = get_post_related_urls( $post_id );
242 -
243 - /**
244 - * Page cache purge urls.
245 - *
246 - * @hook powered_cache_advanced_cache_purge_urls
247 - *
248 - * @param {array} $urls The list of URLs that will purged
249 - * @param {int} $post_id Post ID.
250 - *
251 - * @return {array} New value
252 - * @since 1.0
253 - */
254 - $urls = apply_filters( 'powered_cache_advanced_cache_purge_urls', $urls, $post_id );
255 - $deleted_urls = [];
256 -
257 - if ( $this->settings['async_cache_cleaning'] ) {
258 - $this->cache_purger->push_to_queue(
259 - [
260 - 'call' => 'delete_page_cache',
261 - 'urls' => $urls,
262 - ]
263 - );
264 - $deleted_urls = $urls;
265 - $this->cache_purger->save()->dispatch();
266 - } else {
267 175 foreach ( $urls as $url ) {
268 - if ( delete_page_cache( $url ) ) {
269 - $deleted_urls[] = $url;
270 - }
176 + delete_page_cache( $url );
271 177 }
272 178 }
273 179
274 180 /**
@@ -276,61 +182,39 @@
276 182 *
277 183 * @hook powered_cache_advanced_cache_purge_post
278 184 *
279 185 * @param {int} $post_id The Post ID.
280 - * @param {array} $deleted_urls The list of purged urls with the updated post.
281 - * @param {array} $urls The list of urls that will be purged. @since 3.6
186 + * @param {array} $urls The list of related urls with the updated post.
282 187 *
283 188 * @since 1.0
284 189 */
285 - do_action( 'powered_cache_advanced_cache_purge_post', $post_id, $deleted_urls, $urls );
190 + do_action( 'powered_cache_advanced_cache_purge_post', $post_id, $urls );
286 191 }
287 192
288 193 /**
289 - * Purge post cache when comment status change
194 + * Delete page cache when post update
290 195 *
291 196 * @param int $comment_id Comment ID
292 - * @param string $comment_status Comment status
197 + * @param string $comment_status Status of the comment
293 198 *
294 - * @return void
295 - * @deprecated since 3.4.4
199 + * @since 1.0
296 200 */
297 201 public function purge_post_on_comment_status_change( $comment_id, $comment_status ) {
298 - // deprecate this method in favor of `purge_post_on_comment_update`
299 - _deprecated_function( __METHOD__, '3.4.4', 'purge_post_on_comment_update' );
300 - $this->purge_post_on_comment_update( $comment_id );
301 202 $comment = get_comment( $comment_id );
302 203 $post_id = $comment->comment_post_ID;
303 204 $post_url = get_permalink( $post_id );
205 + delete_page_cache( $post_url );
304 206
305 - do_action( 'powered_cache_advanced_cache_purge_on_comment_update', $post_id, $post_url, $comment_id );
306 - }
307 -
308 - /**
309 - * Delete page cache when a comment update
310 - *
311 - * @param int $comment_id Comment ID
312 - *
313 - * @since 3.4.4
314 - */
315 - public function purge_post_on_comment_update( $comment_id ) {
316 - $comment = get_comment( $comment_id );
317 - $post_id = $comment->comment_post_ID;
318 - $post_url = get_permalink( $post_id );
319 - delete_page_cache( $post_url, true );
320 -
321 207 /**
322 208 * Fires after purging cache for a post that associated a comment
323 209 *
324 - * @hook powered_cache_advanced_cache_purge_on_comment_update
325 - *
326 210 * @param {int} $post_id Post ID.
327 211 * @param {string} $post_url Post permalink.
328 212 * @param {int} $comment_id Comment ID.
329 213 *
330 - * @since 3.4.4
214 + * @since 2.0
331 215 */
332 - do_action( 'powered_cache_advanced_cache_purge_on_comment_update', $post_id, $post_url, $comment_id );
216 + do_action( 'powered_cache_advanced_cache_purge_on_comment_status_change', $post_id, $post_url, $comment_id );
333 217 }
334 218
335 219 /**
336 220 * Purge site when switching to a new theme
@@ -337,37 +221,12 @@
337 221 *
338 222 * @since 2.0
339 223 */
340 224 public function purge_on_switch_theme() {
341 - if ( $this->settings['async_cache_cleaning'] ) {
342 - $this->cache_purger->push_to_queue( [ 'call' => 'clean_site_cache_dir' ] );
343 - $this->cache_purger->save()->dispatch();
344 - } else {
345 - clean_site_cache_dir();
346 - }
225 + clean_site_cache_dir();
347 226 }
348 227
349 228 /**
350 - * Purge site cache when site updated (eg: archived, deleted etc...)
351 - *
352 - * @param \WP_Site $new_site New site object.
353 - * @param \WP_Site $old_site Old site object.
354 - *
355 - * @return void
356 - * @since 2.5.3
357 - */
358 - public function purge_on_site_update( $new_site, $old_site ) {
359 - switch_to_blog( $old_site->id );
360 - if ( $this->settings['async_cache_cleaning'] ) {
361 - $this->cache_purger->push_to_queue( [ 'call' => 'clean_site_cache_dir' ] );
362 - $this->cache_purger->save()->dispatch();
363 - } else {
364 - clean_site_cache_dir();
365 - }
366 - restore_current_blog();
367 - }
368 -
369 - /**
370 229 * Leave a cookie when commenting on a post as usual and don't show the cached page.
371 230 * `comment_author_*` cookies are site-wide available.
372 231 * Don't show cached results just for left a comment 5 months ago is not seems efficient here.
373 232 *
@@ -428,19 +287,9 @@
428 287 if ( ! empty( $settings['rejected_cookies'] ) ) {
429 288 $cookies = preg_split( '#(\r\n|\r|\n)#', $settings['rejected_cookies'], - 1, PREG_SPLIT_NO_EMPTY );
430 289 }
431 290
432 - $wp_cookies = [
433 - 'wp-postpass',
434 - 'wordpressuser_',
435 - 'wordpresspass_',
436 - 'wordpress_sec_',
437 - 'wordpress_logged_in_',
438 - 'powered_cache_commented_posts',
439 - 'comment_author_',
440 - 'comment_author_email_',
441 - 'comment_author_url_',
442 - ];
291 + $wp_cookies = [ 'wp-postpass', 'wordpressuser_', 'wordpresspass_', 'wordpress_sec_', 'wordpress_logged_in_', 'powered_cache_commented_posts' ];
443 292
444 293 if ( ! empty( $cookies ) ) {
445 294 $wp_cookies = array_merge( $cookies, $wp_cookies );
446 295 }
@@ -484,35 +333,9 @@
484 333 */
485 334 return apply_filters( 'powered_cache_vary_cookies', $cookies );
486 335 }
487 336
488 - /**
489 - * Get the list of rejected referrers
490 - *
491 - * @return mixed|null
492 - * @since 3.6
493 - */
494 - public static function get_rejected_referrers() {
495 - $settings = \PoweredCache\Utils\get_settings();
496 - $rejected_referrers = [];
497 337
498 - if ( ! empty( $settings['rejected_referrers'] ) ) {
499 - $rejected_referrers = preg_split( '#(\r\n|\r|\n)#', $settings['rejected_referrers'], - 1, PREG_SPLIT_NO_EMPTY );
500 - }
501 -
502 - /**
503 - * Filter rejected referrer list.
504 - *
505 - * @hook powered_cache_rejected_referrers
506 - *
507 - * @param {array} $rejected_referrers The referrer that will not see the cached page.
508 - *
509 - * @return {array} Rejected referrer list.
510 - * @since 3.6
511 - */
512 - return apply_filters( 'powered_cache_rejected_referrers', $rejected_referrers );
513 - }
514 -
515 338 /**
516 339 * Get the list of rejected user agents
517 340 *
518 341 * @return mixed|void
@@ -541,9 +364,9 @@
541 364 return apply_filters( 'powered_cache_rejected_user_agents', $rejected_user_agents );
542 365 }
543 366
544 367 /**
545 - * Get the list of rejected uri that never get cached
368 + * Get the list of rejected uri that nerver get cached
546 369 *
547 370 * @return mixed|void
548 371 * @since 2.0
549 372 */
@@ -559,9 +382,9 @@
559 382 * Filter rejected uri list
560 383 *
561 384 * @hook powered_cache_rejected_uri_list
562 385 *
563 - * @param {array} $rejected_uri_list The list of rejected uri that never get cached.
386 + * @param {array} $rejected_uri_list The list of rejected uri that nerver get cached.
564 387 *
565 388 * @return {array} New value
566 389 * @since 2.0
567 390 */
@@ -569,67 +392,18 @@
569 392 }
570 393
571 394
572 395 /**
573 - * Get the allowed cache query parameters
574 - *
575 - * @return mixed|null
576 - * @since 3.0
577 - */
578 - public static function get_cache_query_string() {
579 - $settings = \PoweredCache\Utils\get_settings();
580 - $cache_query_strings = [];
581 -
582 - if ( ! empty( $settings['cache_query_strings'] ) ) {
583 - $cache_query_strings = preg_split( '#(\r\n|\r|\n)#', $settings['cache_query_strings'], - 1, PREG_SPLIT_NO_EMPTY );
584 - }
585 -
586 - $query_strings = [
587 - 'lang',
588 - ];
589 -
590 - if ( ! empty( $cache_query_strings ) ) {
591 - $cache_query_strings = array_merge( $query_strings, $cache_query_strings );
592 - }
593 -
594 - /**
595 - * Filter accepted query strings.
596 - *
597 - * @hook powered_cache_cache_query_strings
598 - *
599 - * @param {array} $query_strings The list of query strings that will be cached based on their value
600 - *
601 - * @return {array} New value
602 - * @since 3.0
603 - */
604 - return apply_filters( 'powered_cache_cache_query_strings', $cache_query_strings );
605 - }
606 -
607 - /**
608 396 * These query strings will be ignored during the caching
609 397 *
610 - * @return array
611 - * @since 3.0 deprecated
612 - * @deprecated Use `self::get_ignored_query_strings` instead
398 + * @return mixed|void
613 399 */
614 400 public static function get_accepted_query_strings() {
615 - _deprecated_function( '\PoweredCache\AdvancedCache::get_accepted_query_strings', '3.0', '\PoweredCache\AdvancedCache::get_ignored_query_strings' );
401 + $settings = \PoweredCache\Utils\get_settings();
402 + $accepted_query_strings = [];
616 403
617 - return self::get_ignored_query_strings();
618 - }
619 -
620 - /**
621 - * These query strings will be ignored during the caching
622 - *
623 - * @return mixed|void
624 - * @since 3.0
625 - */
626 - public static function get_ignored_query_strings() {
627 - $settings = \PoweredCache\Utils\get_settings();
628 - $ignored_query_strings = [];
629 -
630 - if ( ! empty( $settings['ignored_query_strings'] ) ) {
631 - $ignored_query_strings = preg_split( '#(\r\n|\r|\n)#', $settings['ignored_query_strings'], - 1, PREG_SPLIT_NO_EMPTY );
404 + if ( ! empty( $settings['accepted_query_strings'] ) ) {
405 + $accepted_query_strings = preg_split( '#(\r\n|\r|\n)#', $settings['accepted_query_strings'], - 1, PREG_SPLIT_NO_EMPTY );
632 406 }
633 407
634 408 $query_strings = [
635 409 'fbclid',
@@ -653,40 +427,26 @@
653 427 'age-verified',
654 428 'usqp',
655 429 'cn-reloaded',
656 430 'ao_noptimize',
431 + 'lang',
657 432 ];
658 433
659 - if ( ! empty( $ignored_query_strings ) ) {
660 - $query_strings = array_merge( $query_strings, $ignored_query_strings );
434 + if ( ! empty( $accepted_query_strings ) ) {
435 + $query_strings = array_merge( $query_strings, $accepted_query_strings );
661 436 }
662 437
663 438 /**
664 - * Filters ignored query strings.
439 + * Filter accepted query strings.
665 440 *
666 - * @hook powered_cache_accepted_query_strings
441 + * @hook powered_cache_accepted_query_strings
667 442 *
668 - * @param {array} $query_strings The list of query strings will be ignored during the caching
669 - *
670 - * @return {array} New value
671 - * @since 2.0
672 - * @depreacated since 3.0
673 - */
674 - $query_strings = apply_filters( 'powered_cache_accepted_query_strings', $query_strings );
675 -
676 - /**
677 - * Filters ignored query strings.
678 - *
679 - * @hook powered_cache_ignored_query_strings
680 - *
681 443 * @param {array} $query_strings The list of query strings will be ignored during the caching
682 444 *
683 445 * @return {array} New value
684 - * @since 3.0
446 + * @since 2.0
685 447 */
686 - $query_strings = apply_filters( 'powered_cache_ignored_query_strings', $query_strings );
687 -
688 - return $query_strings;
448 + return apply_filters( 'powered_cache_accepted_query_strings', $query_strings );
689 449 }
690 450
691 451
692 452 /**
@@ -723,39 +483,6 @@
723 483
724 484 return $rewrite_status;
725 485 }
726 486
487 +}
727 488
728 - /**
729 - * Purge cache when term change
730 - *
731 - * @param int $term_id Term ID
732 - * @param int $tt_id Term Taxonomy ID
733 - * @param string $taxonomy Taxonomy
734 - *
735 - * @since 3.4.2
736 - */
737 - public function purge_on_term_change( $term_id, $tt_id, $taxonomy ) {
738 - $term_taxonomy = get_taxonomy( $taxonomy );
739 -
740 - if ( ! $term_taxonomy->public ) {
741 - return;
742 - }
743 -
744 - $term_url = get_term_link( $term_id, $taxonomy );
745 -
746 - if ( ! is_wp_error( $term_url ) ) {
747 - if ( $this->settings['async_cache_cleaning'] ) {
748 - $this->cache_purger->push_to_queue(
749 - [
750 - 'call' => 'delete_page_cache',
751 - 'urls' => $term_url,
752 - ]
753 - );
754 - $this->cache_purger->save()->dispatch();
755 - } else {
756 - delete_page_cache( $term_url );
757 - }
758 - }
759 - }
760 -
761 -}