Bug: date() & ACF/WP Timezone Discrepancy
-
I’m using the dynamic date functionality, with time.
Posts were disappearing from the list hours before they should, but it’s a huge impact for me because most activity happens in the few minutes before the post “expires”
Because date() returns UTC time but the time from the ACF datepicker field is being localized to the wordpress timezone, its off by the corresponding difference between UTC and the Local Time Zone set in wordpress.
The solution for this is to use wordpress’s custom datetime wrapper function current_datetime() which returns the datetime localized to the wordpress timezone.
Reasons not to use date() are discussed in wordpress here:
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Bug: date() & ACF/WP Timezone Discrepancy’ is closed to new replies.