Have a look at the Action Reference to see generally how requests are processed. After all the loading and init stuff happens, the parse_request action runs when the request is matched against the rewrite rules, and an object is passed containing all the registered query vars and the matched rule and query string.
function wpd_parse_request( $request ){
echo $request->matched_query;
}
add_action( 'parse_request', 'wpd_parse_request' );
After the wp action runs, that same object is stashed in the wp global.
global $wp;
echo $wp->matched_query;
Related Posts:
- How to stop wordpress to make the default query?
- Query two taxonomies via URL or link?
- Multiple endpoints in one URL
- Can not switch the queried post in pre_get_posts hook
- Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?
- Difficulty with rewrite rules
- remove query arg from url after set query
- WordPress add_rewrite_rule() cannot visit lower url levels
- Serve specific “template” page at any URL that ends in its slug
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- How to use if($wp_query->query_vars[‘name’] == ‘pagethatdontexist’) without getting a 404? How to suppress 404
- WordPress rewrite with custom parameter doesn’t work
- How to allow a variable with “/” in wordpress url
- How can I re-query post_type and rewrite the url?
- Rewrite rule pagination on different url levels
- How to list posts of a given format
- Pagination on custom post type not working
- Use REGEXP in WP_Query meta_query key
- Why is the loop not empty on some 404s?
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- WP_Query orderby one custom field then another in one query
- Pagination on a WP_query not showing navigation links
- Multiple custom fields for ‘orderby’ in ‘WP_Query’
- How to order by post_status?
- How to paginate wordpress [gallery] shortcode?
- switch_to_blog() performance considerations & alternatives
- wp_query->max_num_pages always returns 0 on custom post type
- get_template_part in for loop
- Is it possible to select against a post’s parent’s fields with WP_Query?
- Display recent posts from the same category as current post in sidebar
- What’s the best approach for showing posts by A->Z order?
- Load more AJAX on WP Query
- Using is_main_query to select custom post type on certain page
- WP_Query ordered by custom field that is a date string?
- page was loaded over HTTPS, but requested an insecure image
- WP_Query: How do I sort on meta value and use LEFT JOIN?
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to search by title or tags exclusively?
- Paginated pages are showing correct content but pagination links are not
- Query Posts but only return 1 from a custom taxonomy?
- Loop inside the loop
- WordPress search exact match
- How to count post type that has a particular term?
- Group posts by meta_key
- How to Get All Posts but the Private ones?
- How can I hide posts that are over 2 years old
- WordPress custom search form with pre_get_posts not work
- Custom URl parameter
- What is the difference between RELATION “AND” and “OR” in TAX_QUERY?
- order by multiple meta keys in pre_get_posts
- Order By Multiple Meta Fields
- WP_Query order by date in meta_value
- WP_Query pagination not working in admin area
- Custom Field sort not working (WP 3.8.1)
- Get post ID’s from one query and exclude from another
- What are the differences between “Latest Posts” and “Static Page”?
- Retrieve or Query Pages by ID
- WordPress Query is taking more then 20 second and stuck on creating index
- Modifying raw $_POST data early in the lifecycle
- Searching through different categories on different pages code is not working
- Setup of taxonomy term template pages
- Meta query with order by another custom field
- Get the Plugin Which Triggered a MySql Query in WordPress?
- how to get the id for a post from within a post and return post meta for it
- WP_Query’s “request” SQL Query
- Show selected images on top in Media Manager
- How to make this WP_Query run faster on a WordPress website?
- Order taxonomy terms in alphabetical order
- is_search was called incorrectly
- Empty tax_query array returns an empty array
- WP User Query get all authors with last name starting with specific letter
- How do I sort posts with multiple pages
- Sorting By Custom Posts With Attachments
- Complex date range with WP_Query and BETWEEN
- Attachment changing page’s permalink – $post not resetting?
- Is there a way to include a post multiple times in the same query result?
- showing all search result in one template
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- Make (post) query a clickable link
- How to set pagination to work with ‘/page/’?
- How to do meta_query for attachments?
- Most commented last 24h, week, month, year and all time – posts_where
- How can I filter by slug depending on language selection
- How to duplicate 5 posts out of WP_Query results?
- WP Query Args – Title or Taxonomy Value
- Ajax WP_Query reutrns no results on author.php
- WP_query sorting can’t sort danish letters (æ, ø, å)
- Dynamic User Id
- Large AND OR query timing out
- WP_query wp_posts_counts returns only count of admin and not users
- Categorising search results based on Custom Fields
- get_post_meta slowing down my page load (in a plugin)
- Add custom argument to WP_Query and modify SQL where clause
- How does Show Posts based on a keyword search work in WP_Query
- Pagenavi with archive page
- How to get rid of extra Untitled Article in html5 document outline when using new WP_Query?
- WP_Query (or WC_Product_Query) out of memory
- How to display only posts from the last day with posts published?
- Extra filtering on post query
- I need help with filter products in custom teplate