If you are using the ACF Custom Database Tables plugin and have opted to bypass core metadata storage, you’ll likely end up in a situation where you need to create a WP_Query based on data from your custom tables.
The basic approach here is to:
This approach can result in significantly faster WP_Query queries when compared to using meta queries. I ran a few tests against a database containing 1 million records and I saw a 5-second meta query reduce to 1.3 seconds.
Query helpers are something we have planned for a future release but at the time of writing, it’s necessary to put your SQL-writing hat on and write some very basic SELECT statements.
If you haven’t written much SQL before, don’t worry. Basic SQL is really easy and you get the hang of it pretty quickly.
To get you started, I put together the Gist below. As always, if you run into any trouble and need help, we’re only a support request away.