Created
November 8, 2024 13:35
-
-
Save kartikparmar/4b6a14aa01351cd71210b39e71c481a9 to your computer and use it in GitHub Desktop.
Date info in session from bkap date selection form
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
<?php | |
function bkap_date_from_session_cookie( $date ) { | |
if ( $date ) { | |
if ( str_contains( $date, '/' ) ) { | |
$d = DateTime::createFromFormat( 'j/n/y', $date ); | |
$date = $d->format( 'Y-m-d' ); | |
} | |
} | |
return $date; | |
} | |
add_filter( 'bkap_date_from_session_cookie', 'bkap_date_from_session_cookie', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment