@@ -147,6 +147,8 @@ public function purge_post( $post_id ) {
147
147
return ;
148
148
}
149
149
150
+ $ _post_type = get_post_type ( $ post_id );
151
+
150
152
switch ( current_filter () ) {
151
153
152
154
case 'publish_post ' :
@@ -170,7 +172,6 @@ public function purge_post( $post_id ) {
170
172
break ;
171
173
172
174
default :
173
- $ _post_type = get_post_type ( $ post_id );
174
175
$ this ->log ( '* * * * * ' );
175
176
$ this ->log ( '* Blog :: ' . addslashes ( get_bloginfo ( 'name ' ) ) . ' ( ' . $ blog_id . ' ). ' );
176
177
$ this ->log ( "* Custom post type ' " . $ _post_type . "' :: " . get_the_title ( $ post_id ) . ' ( ' . $ post_id . ' ). ' );
@@ -182,8 +183,22 @@ public function purge_post( $post_id ) {
182
183
183
184
$ this ->log ( 'Function purge_post BEGIN === ' );
184
185
186
+ # Here we need something more granular
187
+ # to allow a post type to trigger its purge
188
+ # but skip the homepage purge
189
+ # can use array, if found, skip purge homepage
190
+ # [ 'post_type1', 'post_type1' ]
191
+ # we can also do exceptions by post/page slug too
192
+
185
193
if ( 1 === (int ) $ nginx_helper_admin ->options ['purge_homepage_on_edit ' ] ) {
186
- $ this ->_purge_homepage ();
194
+ if ( ! in_array ( $ _post_type , $ nginx_helper_admin ->options ['homepage_purge_post_type_exceptions ' ], true ) ) {
195
+ $ this ->_purge_homepage ();
196
+ } else {
197
+ $ this ->log ('* * * * * ' );
198
+ $ this ->log ('* Post Type update - ' . $ _post_type . ' - homepage purge trigger excluded... ' );
199
+ $ this ->log ('* ' . $ _post_type . ' in constant array: RT_WP_NGINX_HELPER_HOMEPAGE_PURGE_EXCEPTIONS ' );
200
+ $ this ->log ('* * * * * ' );
201
+ }
187
202
}
188
203
189
204
if ( 'comment_post ' === current_filter () || 'wp_set_comment_status ' === current_filter () ) {
0 commit comments