我正在努力弄清楚为什么下面的代码会导致无限循环,任何指针都会非常棒。
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;
}