Skip to content

Commit da63e56

Browse files
Fix issue of flush cache on post moved to trash.
1 parent 9589ea1 commit da63e56

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

admin/class-purger.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,13 @@ private function _purge_by_options( $post_id, $blog_id, $_purge_page, $_purge_ar
213213
$this->log( "Purging custom post type '" . $_post_type . "' ( id " . $post_id . ', blog id ' . $blog_id . ' )' );
214214
}
215215

216-
$this->purge_url( get_permalink( $post_id ) );
216+
$url = get_permalink( $post_id );
217+
218+
if ( 'trash' === get_post_status( $post_id ) ) {
219+
$url = str_replace( '__trashed', '', $url );
220+
}
221+
222+
$this->purge_url( $url );
217223

218224
}
219225

@@ -575,7 +581,7 @@ public function purge_on_post_moved_to_trash( $new_status, $old_status, $post )
575581
$this->_purge_by_options(
576582
$post->ID,
577583
$blog_id,
578-
false,
584+
true,
579585
$nginx_helper_admin->options['purge_archive_on_del'],
580586
$nginx_helper_admin->options['purge_archive_on_del']
581587
);

0 commit comments

Comments
 (0)