More efficient query: how to get all content in one database call? (1 post)

  1. Tom
    Posted 3 years ago #


    This is my situation:
    I have a custom post type with custom fields and a custom taxonomy. There are about 80 posts in that post type.

    The idea:
    Loop through all the posts of that specific type, show the content of the custom field of that post and order everything by (custom)taxonomy. Show all of that (all 80 posts) on one page.
    I've written this code to make that happen: http://pastebin.com/w2S689Nk

    The problem:
    This is slow. Very slow. And I want it to go faster. If I'm understanding what I've done, this code always makes a database calls per post. My guess is that it's possible to make only one call, get everything at once and so load a lot faster.

    My question:
    How do I make this happen? How do I make everything faster?

    Thank you for your help.


Topic Closed

This topic has been closed to new replies.

About this Topic