Created
March 2, 2016 01:30
-
-
Save jesseeproductions/84138c94cf36732f8da4 to your computer and use it in GitHub Desktop.
Coupon Creator Pro - Fix Leap Year Expiration Date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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