Query vars are… fun like that. Depending on which archive you are messing with get_post_type()
just might be simple enough to do it (it gets type from actual post, not query).
Otherwise you might want to go for get_queried_object()
to figure out what precisely you are dealing with.
Related Posts:
- get_query_var function not working at all
- paginate_links ignore my format
- Query two taxonomies via URL or link?
- Determine WP_Query parameters from URL
- Why query_vars get altered in WP_Query Object?
- WordPress query vars are not added
- Rewrite rule to prettify two $_GET variables while in a new endpoint from a page
- Changing WP_Query params with url Query Var
- query_vars filter not working even though query string parameter is present
- add_filter(‘query_vars’) not working in custom template
- How to get a query variable?
- how to access query string in wordpress?
- Query_vars support in Rest API
- Own query vars are not displayed
- How to redirect a query string to a “virtual” subdirectory
- Passing query variables to a custom page template
- query_vars category_name only display one catgory out of multiple categories
- Send a variable with a URL and get a variable with Wp query
- How to prevent execution of default query, while preserving ability to use WP_Query in template?
- meta_query: using BETWEEN with floats and/or casting to DECIMAL
- How to remove_query_arg() for paginate_links()
- How to force a query conditional?
- How to get order of posts?
- Executing Queries in tag.php
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- WP_Query meta_query by array key
- Trying to list out child pages with WP_Query
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Intentionally exceed max_num_pages on main query without getting 404?
- Pass the same object to multiple widgets in a template with one query
- Why execute the_post()?
- Count total number of post in foreach loop
- WP_Query not retrieving by random order under parent
- Get images only if parent status is publish
- ACF Relationship + WP Template Parts
- Using WP_Query and WP_Meta_Query Outside of WordPress
- query offset countdown by 2 each day?
- How do I make a meta_query OR relation work? [closed]
- How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 – 343)
- Filter posts in category archive page by year using a dropdown
- Show post number in widget loop
- Extend product search with meta in WooCommerce
- Custom Query by Author field and meta
- Include data from custom table in WP_Query
- Query posts by last comments
- Better wordpress attachment query than this
- How to number the posts (ie #1, #2, #3) in a wp_query?
- Does wp track views for posts?
- Filter posts by comparing custom meta value against postdate
- Query posts that contain video?
- Multiple Rows in a using wp_query
- “paged” in WP_Query returns 0 posts
- How to show one post different from the rest?
- Count posts per taxonomy else change taxonomy if less than x number
- Change AJAX filter from POST to GET for URL Parameters
- Running multiple WP_Query
- How to split a post and intercalate elements from a loop
- How to echo woocommerce category name
- How to create a widget like this?
- How can I update post meta inside a WP_Query loop or the WordPress loop?
- Printing a variable inside a custom WP_Query
- Creating attachments archive in tags and categories
- Help with Wp Query
- tax_query in pre_get_posts
- How to prevent WP_Query from filtering on ‘s’ but keep ‘s’ for other purposes?
- Query on meta values and post title
- Add dynamic search to paginated WP_Query
- Adding GROUP BY in Custom Query not working with ORDER BY
- WooCommerce sort by SKU
- Where is the coding error for the unexpected ‘}’ in this if / else choice of loops?
- Show custom content when loop or wp query reaches specific time?
- Query Order By Number Variable From API
- Wp includes access control
- Sorting query_posts() with a complex orderby filter
- Order posts by title and custom field value?
- How to exclude posts by ID within a category/archive loop
- Dynamically Update Page Content
- Optimal way to make tags in tax_query optional?
- How to count posts in loop with infinite scroll?
- Exclude all tagged posts from WP_Query loop
- Bring a post to the top of the query if it’s in a certain category?
- WP Meta Query at depth 2
- WP_query for posts with same post type AND same post category
- Custom query with ‘tax_query’ and ‘meta_key’ returning no results
- WP_Query is being reset after tag (using chaining method)
- Pagination is not working on custom query inside a custom home page template
- Custom conditions in wp query
- Sorting Posts Based On Meta Value Using AJAX
- Sorting: custom query with orderby meta_value_num THEN by title
- Converting an existing query_posts to WP_Query
- WordPress Query showing multiple titles
- custom query to get posts
- Loop being strainge
- Do not show a custom post if it belongs to a certain custom taxonomy
- Problem with WP_Query sort
- wp_query order by rand is repeating posts
- Custom query with custom filtering returning incorrect results
- Best performance for use Custom Field in WP
- How to get post taxonomy url and name in wp_query
- Wp_query to get woocomerce product categorys [closed]