From 5e7ea71820bf7fe401d220dfd8214f1a99d85eed Mon Sep 17 00:00:00 2001 From: Augusto Bennemann Date: Tue, 25 Jun 2024 10:44:13 -0300 Subject: [PATCH] Add filters to exclude post types --- admin/class-nginx-helper-admin.php | 2 +- admin/class-purger.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index f91289a..798b608 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -599,7 +599,7 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu global $blog_id, $nginx_purger; - $exclude_post_types = array( 'nav_menu_item' ); + $exclude_post_types = apply_filters( 'rt_nginx_helper_exclude_post_types', array( 'nav_menu_item' ) ); if ( in_array( $post->post_type, $exclude_post_types, true ) ) { return; diff --git a/admin/class-purger.php b/admin/class-purger.php index ee07019..dd4b8be 100644 --- a/admin/class-purger.php +++ b/admin/class-purger.php @@ -87,6 +87,12 @@ public function purge_post_on_comment_change( $newstatus, $oldstatus, $comment ) $_post_id = $comment->comment_post_ID; $_comment_id = $comment->comment_ID; + $exclude_post_types = apply_filters( 'rt_nginx_helper_comment_change_exclude_post_types', array() ); + + if ( in_array( get_post_type( $_post_id ), $exclude_post_types, true ) ) { + return; + } + $this->log( '* * * * *' ); $this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ). ' ); $this->log( '* Post :: ' . get_the_title( $_post_id ) . ' ( ' . $_post_id . ' ) ' );