[wp-forums] query_posts()

Chip Bennett chip at chipbennett.net
Sat Mar 2 14:47:25 UTC 2013


Good morning, support folks!

I have noticed a few threads where query_posts() is being recommended as
the way to modify query parameters.

Instead of recommending use of query_posts(), I think the official support
recommendation should be to use 'pre_get_posts' for modifying the main
query, and new WP_Query() for creating secondary loops.

Nacin (as usual) explains it best:
http://www.slideshare.net/andrewnacin/you-dont-know-query-wordcamp-portland-2011

In general, using query_posts() often introduces more problems than it
solves. (Pagination is usually the biggest one.)


More information about the wp-forums mailing list