79152658

Date: 2024-11-03 12:06:23
Score: 1
Natty:
Report link

Consider the following solutions:

  1. When creating the post, make sure to use update_field() for the event_date field. This function saves the value in a way that ACF and WordPress recognize.

  2. Re-save the post meta with acf_update_value:

    $event_date = '2024-01-01'; // Example date

    acf_update_value($event_date, $post_id, 'event_date');

  3. If the event_date is stored as YYYYMMDD (the ACF default) or Y-m-d, ensure that the value set programmatically matches this format. Passing an incorrectly formatted date can cause issues with sorting if ACF expects YYYYMMDD.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Om Prakash Swami