| @@ -43,22 +43,15 @@ | ||
| 43 | 43 | if ( $days < 1 ) { |
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - // _bbp_last_active_time is stored in site-local time. | |
| 48 | - $cutoff = wp_date( 'Y-m-d H:i:s', time() - ( $days * DAY_IN_SECONDS ) ); | |
| 47 | + $cutoff = date( 'Y-m-d H:i:s', strtotime( "-{$days} days" ) ); | |
| 49 | 48 | |
| 50 | - // Stickies are skipped below; exclude them up front so they can't fill | |
| 51 | - // every batch and stop the rest from ever being closed. | |
| 52 | - $stickies = array_map( 'intval', array_merge( (array) bbp_get_super_stickies(), forumax_get_all_forum_stickies() ) ); | |
| 53 | - | |
| 54 | 49 | // Get open topics with no recent replies |
| 55 | 50 | $args = [ |
| 56 | 51 | 'post_type' => 'topic', |
| 57 | 52 | 'post_status' => 'publish', |
| 58 | - 'posts_per_page' => 100, // Batch to avoid timeouts | |
| 59 | - 'post__not_in' => $stickies, | |
| 60 | - 'no_found_rows' => true, | |
| 53 | + 'posts_per_page' => 50, // Batch to avoid timeouts | |
| 61 | 54 | 'meta_query' => [ |
| 62 | 55 | [ |
| 63 | 56 | 'key' => '_bbp_last_active_time', |
| 64 | 57 | 'value' => $cutoff, |