Dates in new Looper Query Builder

I’m super excited to work with the new Looper Query Builder! It’s getting me so much closer to things I want to accomplish. However, I’ve run into a weird issue Meta Values and Dates.

I have a WordPress Multisite instance. There is one “main” site and several “spoke” sites. I have a custom post type called “Programs” on each of the sites, and I’ve used ACF fields on these posts. They are setup identically on all sites in the network. I then have some custom code duplicating those “Program” posts from the main site to the “spoke” sites.

The Programs each have 4 ACF date fields - Start Date, End Date, Registration Open Date, and Registration Close Date. All ACF fields are setup using the format “F j, Y” for the Display and Return format. That’s also the Date Format setting in Settings > General on each site.

All of this is working fine. I have a page built with a looper for these programs. Prior to this release, I was pulling in all Programs via the Looper Provider and then set some Conditions on the Consumer to do things like show/hide based on the Program Dates. This worked OK except that I couldn’t ever get a “no results” type of message because there were always results from the Provider (even if the Consumer filtered them out.) So, when this new release came out, I decided to try to use the Query Builder and Meta Values.

On the main site, these work like a charm. However, on the “spoke” sites, the results are very mixed. After a lot of digging around, I realized that’s because the dates are not being saved in the database for the “spoke” sites in Ymd format, and the Query Builder Meta Values ONLY seem to work when they are in Ymd format. I tried leaving the {{dc:global:date}} field alone and not specifying a format. And I tried all the various formats. But I’m not having much luck.

It got more complicated because I played with various settings, and now I fear I have dates in different formats across different records. But I’m wondering if there is a way around this? The Conditions seemed to work fine, regardless of date formats. Is the Meta Query supposed to work like the Conditions and accept a variety of formats?

Hi Danni,

Unfortunately, you need to maintain the same date format that has been set and saved in the database.

Thanks

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