Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jesseeproductions/84138c94cf36732f8da4 to your computer and use it in GitHub Desktop.
Save jesseeproductions/84138c94cf36732f8da4 to your computer and use it in GitHub Desktop.
Coupon Creator Pro - Fix Leap Year Expiration Date
$args = array(
'posts_per_page' => 2000,
'post_type' => 'cctor_coupon',
);
$cctor_exp_update = new WP_Query( $args );
if ( $cctor_exp_update ) {
while ( $cctor_exp_update->have_posts() ) : $cctor_exp_update->the_post();
$expiration = get_post_meta($cctor_exp_update->post->ID, 'cctor_expiration', true);
if ( '03/29/2016' == $expiration ) {
update_post_meta( $cctor_exp_update->post->ID, 'cctor_expiration', '03/31/2016' );
update_post_meta( $cctor_exp_update->post->ID, 'cctor_expiration_mysql', date('2016-03-31 12:00:00' ) );
}
endwhile;
}
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment