Skip to content

Commit 8deccfb

Browse files
authored
Merge pull request #1 from gridpane/release-cpt-exclude
Release cpt exclude
2 parents c2fab7a + 5e26285 commit 8deccfb

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

admin/class-nginx-helper-admin.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,17 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu
669669

670670
global $blog_id, $nginx_purger;
671671

672-
$exclude_post_types = array( 'nav_menu_item' );
672+
$exclude_post_types = apply_filters( 'rt_nginx_helper_exclude_post_types', array( 'nav_menu_item' ) );
673673

674-
if ( in_array( $post->post_type, $exclude_post_types, true ) ) {
674+
$post_type = $post->post_type;
675+
676+
if ( in_array( $post_type, $exclude_post_types, true ) ) {
677+
if ( 'nav_menu_item' !== $post_type ) {
678+
$nginx_purger->log('* * * * *');
679+
$nginx_purger->log('* Post Type update - ' . $post_type . ' - purge trigger excluded...');
680+
$nginx_purger->log('* Filter: -> rt_nginx_helper_exclude_post_types');
681+
$nginx_purger->log('* * * * *');
682+
}
675683
return;
676684
}
677685

@@ -691,10 +699,10 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu
691699
if (
692700
'future' === $new_status && $post && 'future' === $post->post_status &&
693701
(
694-
( 'post' === $post->post_type || 'page' === $post->post_type ) ||
702+
( 'post' === $post_type || 'page' === $post_type ) ||
695703
(
696704
isset( $this->options['custom_post_types_recognized'] ) &&
697-
in_array( $post->post_type, $this->options['custom_post_types_recognized'], true )
705+
in_array( $post_type, $this->options['custom_post_types_recognized'], true )
698706
)
699707
)
700708
) {

admin/class-purger.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ public function purge_post_on_comment_change( $newstatus, $oldstatus, $comment )
8686

8787
$_post_id = $comment->comment_post_ID;
8888
$_comment_id = $comment->comment_ID;
89+
$_post_type = get_post_type( $_post_id );
90+
91+
$exclude_post_types = apply_filters( 'rt_nginx_helper_comment_change_exclude_post_types', array() );
92+
93+
if ( in_array( $_post_type, $exclude_post_types, true ) ) {
94+
if ( 'nav_menu_item' !== $_post_type ) {
95+
$this->log( '* * * * *' );
96+
$this->log('* Post Type comment update - ' . $_post_type . ' - purge trigger excluded...');
97+
$this->log('* Filter: rt_nginx_helper_comment_change_exclude_post_types');
98+
$this->log( '* * * * *' );
99+
}
100+
return;
101+
}
89102

90103
$this->log( '* * * * *' );
91104
$this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ). ' );

0 commit comments

Comments
 (0)