Skip to content

Commit 6271490

Browse files
Merge pull request #456 from rtCamp/feat/exclude-post-types
Add filters to exclude post types
2 parents 68a517c + 7048240 commit 6271490

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

admin/class-nginx-helper-admin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,9 +652,9 @@ public function update_map() {
652652
public function set_future_post_option_on_future_status( $new_status, $old_status, $post ) {
653653

654654
global $blog_id, $nginx_purger;
655-
656-
$exclude_post_types = array( 'nav_menu_item' );
657-
655+
656+
$exclude_post_types = apply_filters( 'rt_nginx_helper_exclude_post_types', array( 'nav_menu_item' ) );
657+
658658
if ( in_array( $post->post_type, $exclude_post_types, true ) ) {
659659
return;
660660
}

admin/class-purger.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ public function purge_post_on_comment_change( $newstatus, $oldstatus, $comment )
8787
$_post_id = $comment->comment_post_ID;
8888
$_comment_id = $comment->comment_ID;
8989

90+
$exclude_post_types = apply_filters( 'rt_nginx_helper_comment_change_exclude_post_types', array() );
91+
92+
if ( in_array( get_post_type( $_post_id ), $exclude_post_types, true ) ) {
93+
return;
94+
}
95+
9096
$this->log( '* * * * *' );
9197
$this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ). ' );
9298
$this->log( '* Post :: ' . get_the_title( $_post_id ) . ' ( ' . $_post_id . ' ) ' );

0 commit comments

Comments
 (0)