Software Engineering in Web Development, Backend Services, and More

Search: “wp_query” (Page 4 of 29)

We found 145 results for your search.

Custom Archive Templates: A Short Guide

[…] is a list of functions, pages, and references that you may find useful as it relates to the code above or any future work you may do. WP_Query Pagination pre_get_posts get_query_var set_query_var get_next_posts_page_link get_previous_posts_page_link update_post_meta wp_reset_postdata The full code in this post. If you’ve been working with WordPress for a long time, some of […]

Understanding WP_Query

I’ve done my fair share of work with WP_Query this week – it’s definitely been an exercise in education, but when an employee of Automattic comments and offers advice, it’s worth listening But I wanted to keep the conversation going for the benefit of other developers. As such, I wanted to reblog this talk […]

Displaying The Most Recent WordPress Query

Looking the most recent WordPress query that is run on a given page can be useful for several reasons:

– you see how the information in the database is retrieved,
– you learn how the underlying query system works,
– you’re able to benchmark your custom queries,
– and more.

In a recent article for Envato, I share a 60-second video on how you can quickly take a look at the last query executed on a given page.

The Dangers of Using pre_get_posts in WordPress

[…] Using pre_get_posts in WordPress As mentioned in the previous post, whenever you hook a function into the `pre_get_posts` action, then you’re passed – by reference – the `$ wp_query` object. As such, the code looks something like this: function demo_exclude_category( $wp_query ) { // Add the category to an array of excluded categories. In this […]

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑