As @milo said in the comments, the cat
parameter (and similar parameters in other hierarchical taxonomies) will make the query look in subcategories as well. If you do not want that to happen use the category__in
parameter.
As for the general slowness, it is hard to guess, but it depends on your DB server performance (maybe it is under constant load and it is time to upgrade it) and how “deep” are those posts in the table.
Last but not least, if you do not need the information of how many matching results exist beyond your limit, you should try adding 'no_found_rows' => true
to your query. That way the DB will not try to calculate the number of total posts in the category (the SQL_CALC_FOUND_ROWS
part of the query)
Related Posts:
- Is it possible to dynamically get queried term AND taxonomy?
- How do I search inside specific taxonomies in WordPress
- Pass array of taxonomy terms to wp_query
- How to add custom meta to ‘pre_get_terms’?
- How to show terms from another taxonomy
- How can I get all the posts that are related with a specific taxonomy term?
- Wp get all the sub pages of the parent using wp query
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Search custom taxonomy term by name
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- How to uniquely identify queries?
- How to display post from current Taxonomy in archive page?
- Get posts by meta data OR title
- WP_Query ordered by custom field that is a date string?
- How to make an activities stream mixing posts and comments?
- Duplicate Queries
- How to query for a week using key => value WP_Query argument notation?
- SQL query equivalent to WP User Query
- How to count post type that has a particular term?
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- meta_query on a date range using an array of values
- WP_Query Performance Issues with meta_query
- How to detect custom query inside `posts_where` hook?
- Is temporarily overwriting $wp_query a bad idea?
- Query Set Order By Author
- Filtering posts by custom field value not working
- How to output different posts per page?
- How to do a query on custom taxonomies that is uncategorised?
- Empty tax_query array returns an empty array
- How to orderby meta_value_num with dollar ($) sign
- Formulate a url to show posts with both taxonomy terms
- merge two query arguments into one WP_Query call
- Using WP_Query in “parse_query” or “pre_get_post” in Posts2Posts
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Query: offset post list, unless it’s a specific category
- How to reduce the number of queries?
- Output an array of terms for a ‘tax_query’ => array()
- List of the years with posts presented
- WP_Query Not Recognizing Taxonomy Parameter in Custom Search
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Query custom post type by custom taxonomy (category slug)
- Advanced Taxonomy Queries WordPress
- Custom Query num_rows returns wrong amount
- Editing the default wordpress search
- Weird orderby => post__in issue
- Slow page loads due to WordPress Core Query
- Set global $wp_query/$post variable for dynamic page generation
- WP_Query with ‘rand’, but equal number of posts from the taxonomy terms given
- Multisite pagination issue by multi query archive 404
- Query with relation and one without relation using multiple taxonomies?
- Automatically Query Parent Taxonomy
- Custom taxonomy.php not working
- Sort WordPress Posts Meta value by Week not Day
- 2 wordpress loops showing 1 post from same post type – how to avoid showing the same post?
- Transient api Caches confused
- How can I override one post and make it display content for another post?
- WP_Query for a taxonomy with different taxonomy types
- Get multiple users with meta value in one query and populate WP_User class
- Get Child Category only
- Query where ANDing slug values not working
- How to filter query loop block with a search string from the query parameters
- How to SQL query posts IDs by categories AND authors?
- Custom taxonomy in WP_Query not working
- Can’t get term id for category archive
- How to make a post with certain taxonomy term display first before other post with only one query?
- Post incorrectly excluded when using “category__in”?
- Query multiple post types, but different order for each
- Use get_cat_ID to retreive multiple category IDs
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- How to use the Term Object from a custom select field in a query
- Any way to use FETCH_KEY_PAIR with $wpdb?
- WP_Query paginate with one term per page?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Query against multiple locations within single custom post type post
- How to get_comments() ordered by date and parent?
- How to query users by post count no less than 10
- WP Query. Ordering posts by another post types meta
- How to make a search query if not found in post table then search in postmeta table?
- Adding Category in WP_Query Not Working
- Merge two queries and remove duplicate
- Taxonomy Terms That Don’t Exist Display Results
- how to show more than 1 post into three columns query
- Category Archive not working for pages
- Using the same WP_Query for shop and widgets in WooCommerce shop
- Fetch only categorized posts
- WP Query with sticky posts and tax_query
- Custom pagination (Title, date and teaser)
- Pagination in custom query in a category page
- Get a list of the last posts grouped by author and filtered by category
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to query post ids liked by the Author
- Modify query after meta value
- Showing posts from 4 categories along with all latest posts
- Pagination in WP query with transient API
- Main loop querying current template’s info only in custom category archive pages, not my posts
- tax_query not working properly with get_posts
- A Depth Like Parameter For “get_posts”
- Search query alteration not working for meta values
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Advanced Search – Is this possible?