Support

Account

Home Forums General Issues Query Through Three Post Types

Helping

Query Through Three Post Types

  • Is it possible to query on three different post types using a key for each link? I’ll explain my data below:

    I created three custom post types:

    Exercises – a post type that contains information about specific exercises, includes four custom fields
    Phases – collection of exercises, grouped by grade level (for example phases 0-10 – first grade 0-10 second grade)
    Programs – collection of phases with associated dates of visibility

    There is also a custom field for each individual user attaching them to a designated program.

    What I need to do is loop through a list of programs, that loops through a list of phases, that pulls specific data from exercises.

    Is this sort of operation possible?

  • There isn’t any way to do this. This is not a limitation in ACF but a limitation of WP.

    You need to do 3 or more separate queries, each one building on the last, with multiple nested loop to go through each of the posts at each step.

    It might be possible to construct an SQL query to do the work, but it would be an extremely complex query that in all likelyhood would time out the page.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Query Through Three Post Types’ is closed to new replies.