• Simbo Smith

    (@london-drum)


    Hello.

    I’ve recently learnt that if you use query_posts in a template file then you are effectively wasting a database lookup, because WordPress has already retrieved the relevant posts from the database before it even reads your template files.

    So if it’s a category page, WordPress will first grab all of the category posts (based on the URL), and then it will read your template file and see the query_post, and then it will be forced to retrieve them all over again.

    My site is big enough that i need to save all the queries i can, so i was wondering if anyone knows where the line is in the core files that retrieves the posts BEFORE it reads the template files, so i can stop it from happening. My site is designed in such a way that i always use query_posts, no matter what the URL is, so i dont mind doing away with that original query completely.

    any help will be much appreciated

The topic ‘Speed up site: Prevent WordPress from retrieving posts?’ is closed to new replies.