Advanced Post Queries: Best Practices for Accessing your Data

Whether you’re maintaining a personal blog, or leveraging WordPress as your CMS backbone, you will eventually want to modify what content WordPress sends to your pages from the database. WordPress itself provides a rich set of tools and methods for interacting with the database, most of which don’t even require database expertise. Each method is appropriate in certain circumstances, and should be avoided in others. This talk discusses each method of generating or modifying the database query when and how each should be used. While this discussion focuses on coding, even those just starting out will be sure to learn best practices around how and when to use “query_posts()” vs. “get_posts()” vs. “new WP_Query()” to build custom lists of posts. Seasoned developers will appreciate discovering the right way to use hooks like “pre_get_posts”, “request” and “posts_clauses” to access the query at the lowest levels.

Although this talk deals exclusively with PHP coding and the WordPress API, it is targeted at a very broad audience from WordPress coding beginners through to experts. If code makes you break out in a rash, this might not be the right talk for you.

View slides on Slideshare »

About Tom

Tom Auger is a designer, developer and educator and a core contributor to WordPress. His passion is to gain a deep understanding of the inner workings of WordPress internals and he leverages this knowledge in client-facing projects with digital agency Zeitguys, inc, as well as by giving back to the WordPress community through support forums, the WordPress Codex, and talking at WordCamps. Follow @tomauger on Twitter.