Share this:

Technorati ReddIt Favorites

Feature | Of The Day

Features Filter

Product:
Tags:

Follow us on Twitter

Feedburner Features Feed

Sign up to receive features of the day to your email.

Debugging of WP Query and template loading

With all new and great features added to WordPress over the past year, with custom post types and custom taxonomies, it can be a big problem to determine why something is not working or why templates are not loading.

GD Press Tools Pro has a very powerful debugger built in, and this debugger can help you debug most of the things WordPress does. This time, here is how you can determine what template WP loads and why. This will work on any page of your website. First, you need to enable the debugger, and for that check the previous feature of the day: configuration for the advanced debugger.

URL Request

URL Request

Each page in WP  is displayed through WP Query object. WP analyzes the URL request to get the results for the page. First tab in the debugger panel (General Stats), in the middle column shows current URL request analyzed. You see request, matched rewrite rule and matched query. Based on that, WP loaded template.

WP Query

WP Query

WP Query tab on the debugger panel shows more detail on the Query object in 3 columns of data. First contains detected query type and SQL query executed by WordPress.

Middle column (left image) shows main query variables and main taxonomy query variables, based on the matched URL request. If you are not sure that query is resolved properly, you maybe have conflict in rewrite rules, and on the WP Core tab you have the list of all rewrite rules in the system.

Third column shows full list of query variables based on requested variables values.