Page is a not externally linkable
- Code, Content, and Presentation
-- WordPress
---- Speed up Wordpress: Prevent original database lookup?


londrum - 12:56 pm on Aug 17, 2011 (gmt 0)


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 what the URL is), 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 getting big enough now 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


Thread source:: http://www.webmasterworld.com/wordpress/4352494.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com