Last active
August 29, 2015 13:55
-
-
Save vajrasar/8707195 to your computer and use it in GitHub Desktop.
Not Working.
This file contains 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
<?php | |
function vg_update_timestamp( $post_id ) { | |
$startdate = get_post_meta($post_id, 'cmb_from_textdate', true); //not unix timestamp | |
$enddate = get_post_meta($post_id, 'cmb_till_textdate', true); //not unix timestamp | |
$timestamp_start = strtotime( $startdate ); | |
$timestamp_end = strtotime( $enddate ); | |
update_post_meta($post_id, 'cmb_from_textdate_unix', $timestamp_start ); | |
update_post_meta($post_id, 'cmb_till_textdate_unix', $timestamp_end ); | |
} | |
add_action( 'save_post', 'vg_update_timestamp' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment