Skip to content

Commit

Permalink
Add comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauteri committed Sep 13, 2024
1 parent cadd29b commit 3d4e673
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions includes/classes/class-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,24 +429,23 @@ private function fix__0_30_0(): void {
* @return void
*/
private function fix__0_31_0(): void {
$batch_size = 100; // Number of posts to process per batch.
// Add datetime meta and resave.
$batch_size = 100;
$paged = 1;

do {
$args = array(
'post_type' => 'gatherpress_event',
'posts_per_page' => $batch_size,
'paged' => $paged,
'fields' => 'ids', // Only retrieve post IDs for efficiency.
'fields' => 'ids',
);
$query = new WP_Query( $args );

// If no posts found, break the loop.
if ( ! $query->have_posts() ) {
break;
}

// Loop through each post and update the meta.
foreach ( $query->posts as $post_id ) {
if ( get_post_meta( $post_id, 'gatherpress_datetime', true ) ) {
continue;
Expand Down

0 comments on commit 3d4e673

Please sign in to comment.