ACF Dates and WP All Import and date sorting

WRT ACF Date Format Import and Sorting

The post I made earlier only works until you manually add a post, using an ACF Date picker.

Here’s the right way to import dates from CSV

  • Format the date inside your XLS and CSV as YYYY-MM-DD HH:MM:SS
  • Import it in this format
  • This matches the way ACF stores dates
  • When you then add a record manually using a date time picker, it will also store the data in this format

You can then run a query string in the builder to sort by date ASC or DESC, and you can also add into your meta query a >= condition and the global variable {{dc:global:date format=“Y-m-d”}} to find items beyond todays date.

If you import records as I suggested in the earlier post, they will clash with manually created records.

  • Imported CSV data is stored in the format you provide e.g. YYYYMMDD
  • Dates picked using an ACF date picker will have the format YYYY-MM-DD

When you try to mix those rows, madness occurs. One way to debug this is using the JSM Show Post Metadata plugin which will uncover the actual format of the data fields held for your CPT.

Good luck, Bill.

ThemeCo: No action required on your part!

Hi Bill,

Glad that you shared the information.

Thanks

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