How To Display The Last WordPress Query
read more
Categories

How To Display The Last WordPress Query


Have you ever had the, ahem, pleasure of customizing the WordPress query? One of the most useful things in debugging is displaying the last WordPress query.

Let’s say you’re working with taxonomies and/or post types and you’re passing custom parameters around. And then, you want to setup some debugging to see exactly what’s hitting the database.
This is helpful for a variety of reasons if for no other reason than to see what is running against the database. It gives you insight on what you’re requesting and thus what you’re presenting to the user.

Anyway, writing code to do this is easy.