Skip to content

Instantly share code, notes, and snippets.

@vajrasar
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vajrasar/8707195 to your computer and use it in GitHub Desktop.
Save vajrasar/8707195 to your computer and use it in GitHub Desktop.
Not Working.
<?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