ACF Date Format Import and Sorting

With reference to this earlier closed post:

For future people, I couldn’t get looper to sort on a date field, the order of the output seemed random. With trial and error, I discovered that the text format in the CSV or Excel file needs to be yyyymmdd hh:mm for the results to be correct.

Using the plugin ‘JSM’s Show Post Metadata’ shows the literal / actual content of the ACF fields, and what I saw is that after import using WP All Import, the string format is exactly as above. Of course storing the string in yyyy mm dd format means it will sort in the right order as the text will do that for you.

What’s interesting is that if you format the output in Pro using a DC field like this {{dc:acf:post_field field=“hps_start_date” type=“date” format=“jS M Y”}} - Pro (or Wordpress) will interpret the text correctly and output a format like “25th March 2023”, but the underlying Looper sorting will work.

  • Make sure your import file has a date format in yyyymmdd h:mm format
  • Use ACF to set the display and return formats as you wish
  • Use the above format trick inside Pro to set the styling

No action required from ThemeCo, this is for future builders and Google to index.


Hi Bill,

Thanks for posting this helpful information.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.