Title: WP Query parameter
Last modified: February 6, 2023

---

# WP Query parameter

 *  Resolved [mukethedude](https://wordpress.org/support/users/mukethedude/)
 * (@mukethedude)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/)
 * Output of an standard Archive Link of a customer post type with 3 taxonomies.
   How to find out the parameters of the wp_query after. (archive.php)
 * Output of a single post of a customer post type . How to find out the parmeters
   of the query which have led to the result on the the single.php

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16446018)
 * Install the plugin “Query Monitor”. It will help you track the queries used to
   render a page.
 *  Thread Starter [mukethedude](https://wordpress.org/support/users/mukethedude/)
 * (@mukethedude)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16446224)
 * Thanks for your quick help. very usefull !
 * but, how to find out the parameters via php on archive.php/single.php to add 
   other information depending on result.
 * regards muki
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16446227)
 * you’ll have to work backwards from the query to determine the actual call(s) 
   to wp_query.
 *  Thread Starter [mukethedude](https://wordpress.org/support/users/mukethedude/)
 * (@mukethedude)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16446264)
 * Thx again Steven !
 * sorry i dont understand “backwards”. do u have an example ?
 * i am a step further but **i think its not a smart solution**.
 * on my archive.php i get with if/elseif statements on function is_tax() the right
   taxonomy of my custome post type:
 * if (is_tax(‘taxonomy,’taxonomy_name’)) $taxonomy_title = ‘some_string’;
 * elseif …. 4 times for 4 taxonomies
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16449417)
 * I think you are saying you don’t want to look at the parameters with a tool like
   Query Monitor, you want to get them with PHP for use in outputting related information
   from template code. Correct?
 * The main query’s WP_Query object is generally available from global $wp_query.
   All the query vars used are within $wp_query->query_vars. The actual SQL used
   is $wp_query->request. Almost everything you would want to know about the query
   is likely somewhere within its properties. Examine the class’ properties in [its source code](https://core.trac.wordpress.org/browser/tags/6.1/src/wp-includes/class-wp-query.php#L19)
   to see what else is available.
 * Note that secondary queries can overwrite the global $wp_query value so that 
   it no longer represents the main query. You can confirm if this has happened 
   with $wp_query->is_main_query().
 *  Thread Starter [mukethedude](https://wordpress.org/support/users/mukethedude/)
 * (@mukethedude)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16453774)
 * Thanks,
 * good advice to find the parameters directly in the wp_query array.
 * i thought there are already some wp functions to grep them directly.
 * Thanks and greetings to the supporters
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16456611)
 * > i thought there are already some wp functions to grep them directly.
 * Not literally grep-like, but there is [get_query_var()](https://developer.wordpress.org/reference/functions/get_query_var/).
   It’ll get any specific query var value from the global $wp_query object. It’s
   just a wrapper for `$wp_query->get()`. It’s about as close as we get to directly
   grepping something.
 *  Thread Starter [mukethedude](https://wordpress.org/support/users/mukethedude/)
 * (@mukethedude)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16460840)
 * THANKS !

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘WP Query parameter’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [tags](https://wordpress.org/support/topic-tag/tags/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 8 replies
 * 3 participants
 * Last reply from: [mukethedude](https://wordpress.org/support/users/mukethedude/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/wp-query-parameter/#post-16460840)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
