Last active
August 30, 2019 10:34
-
-
Save kaskad88/dadcf79e1478d6d711d8e2a2b515ff5d to your computer and use it in GitHub Desktop.
Create alt date post meta ( timestamp )
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
add_action( 'save_post_event', '__your_prefix__save_event_start_date_timestamp', 10, 3 ); | |
function __your_prefix__save_event_start_date_timestamp( $post_id, $post, $update ) { | |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { | |
return; | |
} | |
$event_start_date = $_POST[ 'event_start_date' ]; | |
if ( empty( $event_start_date ) ) { | |
return; | |
} | |
$event_start_date_timestamp = date_i18n( 'U', strtotime( $event_start_date ) ); | |
update_post_meta( $post_id, '_je_event_start_date_timestamp', $event_start_date_timestamp ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment