List All WordPress Query Vars: A Step Guide – WordPress Tutorial

By | November 27, 2020

Sometimes, we need to know what query vars are used in wordpress. In this tutorial, we will tell you how to list all of them.

The simpleset way is print global $wp_query in wordpress.

For example:

global $wp_query;

Run this code, you will find a list query vars as follows:

WP_Query Object
    [query] => Array
            [pagename] => wordpress-theme

    [query_vars] => Array
            [pagename] => wordpress-theme
            [error] => 
            [m] => 
            [p] => 0
            [post_parent] => 
            [subpost] =>

You can find all query vars used in wordpress from query_vars and current query var used in current page.

list all query vars in wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *