I am struggling to work out why the below code would cause an infinite loop, any pointers would be brilliant.
function send_reminder_email() {
$args = array(
'post_type' => 'product',
'meta_key' => 'WooCommerceEventsDate',
'orderby' => 'meta_value_num',
'post_status' => 'publish',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'WooCommerceEventsDate',
'value' => date('Y-m-d', strtotime('+7 days')),
'compare' => '=',
),
),
);
$query = new WP_Query( $args );
if($query->have_posts()) :
while($query->have_posts()) :
$query->the_post();
$event[] = array( "title" => get_the_title(), "id" => get_the_ID());
endwhile;
endif;
wp_reset_query();
print_r($event);
foreach($event as $key => $value):
$args = array(
'post_type' => 'event_magic_tickets',
'meta_key' => 'WooCommerceEventsProductID',
'post_status'=> 'publish',
'meta_query' => array(
array(
'key' => 'WooCommerceEventsProductID',
'value' => $value['id'],
'compare' => '=',
),
),
);
$ticketQuery = new WP_Query( $args );
if($ticketQuery->have_posts()) :
while($ticketQuery->have_posts()):
echo "Do something here.";
endwhile;
endif;
wp_reset_query();
endforeach;
}