You could just write your own query, too. That way, it’s one query per category:
global $wpdb;
$query = '
SELECT wpp1.*
FROM ' . $wpdb->posts . ' AS wpp1
LEFT JOIN ' . $wpdb->term_relationships . ' AS wptr1 ON wptr1.object_id = wpp1.ID
WHERE post_type = %s
AND post_status = %s
AND wptr1.term_taxonomy_id = %d
ORDER BY wpp1.post_date DESC
LIMIT %d
';
$query = $wpdb->prepare(
$query,
// Args: post type, post status, term taxonomy ID, number of posts
'post', 'publish', 80, 3
);
$posts = $wpdb->get_results(
$query,
ARRAY_A
);
Related Posts:
- Get all categories and posts in those categories
- Combine two taxonomies in a hierarchical tree
- How to get posts from two categories with WP_Query?
- Group WP_Query by category
- Should I use Transients with W3 Total Cache APC Caching? [closed]
- Exclude categories from search query
- WP_Query not looking at child category
- Get page content by category or tag
- Excluding posts from a category but only if they’re not in multiple categories
- What could be causing my wp_query pagination to break?
- Custom query with category exclusion and post-meta “whitelist”
- Get terms that are associated with products from current category
- Exclude most recent posts from specific category in wp_query()
- Display one latest post from multiple categories
- How to Check if a Child Category is Being Queried
- How to run WP_Query to retrieve attachments to posts only from a particular category?
- How to query posts from specific authors and categories using WP_query?
- How to show in search results posts with a particular tag in a particular category?
- Custom WP_Query for current category (in category.php)?
- List Posts by Category for a Non-Zero, Non-NULL Custom Field Value?
- getting content from main domain to sub-domain using category and WP_Query
- WP_Query() returns null when results exist!
- Ignoring a category in WP_Query still shows the links in next_post_link()?
- 3 Columns, 3 Categories, One Archive, and Pagination
- Enter a variable in the ‘category_name’ parameter
- How to query post like normal search would do. within search.php page
- Should wp_query automatic meta and term cache priming be used in an enviroment with an object caching
- Multiple Loops on category.php with pagination on last loop
- How to get latest posts from each category in regular order
- change recent posts based on category
- How to remove specific categories from posts?
- Set colors depending on category
- Display posts from a category
- Custom loop of a single category, cannot order by date. What am I missing?
- Pagination on category.php and tag.php not working
- category__not_in and id values from variable
- Use premade array as categories in wp_query?
- WP_Query – using category__and when one of the categories is 0
- More efficient way to list posts by category [duplicate]
- Adding a block with query in homepage
- Query posts by views on category page
- I need to exclude from a query a category and a few custom taxonomies
- Show multiple categories in query using redux framework variable
- Are term_taxonomy_id and term_id the same? [duplicate]
- Return category posts with WP_Query
- Using in ‘category_name’ in ‘$query->set();’?
- multiple values in an array for category__and does not work with WP_Query
- Custom Page Template Category loop not functioning correctly
- Retrieve post tags from from main wp_query
- Posts of specific category on page and excluded from index.htm
- new WP_Query issues
- How can I use AJAX with check-box categories?
- Select posts that match multiple category names, must match all categories listed
- the_category() doesn’t working in wp_query loop
- How to display the 5 latest post titles but allow only 1 in there of a specific category
- Categories are not available AT ALL under Menus
- Number of categories slowing down the site
- Category For Pages In WordPress
- Unable to get all tags from specific categories
- category__and works, but why?
- foreach,having wp_query inside, breaks after showing one result
- Display related posts with same category or same tag return blank
- $args Orderby The number
- Querying Multiple Categories With Different Offsets
- WordPress Numeric Pagination with Query String [duplicate]
- Printing direct descendants of a category with WP_Query
- Custom Category Page Not Working [duplicate]
- WP_query exclude a category unless it has more than one catagory
- Show only one category in main query, issues on tag page
- Multiple Categories under one URL, where ‘Front Page’ is used already
- How do i add custom post types to this query?
- Narrow Down a Shop Page Results Based on a Product Tag in WooCommerce
- How to retrieve posts from parent category, splitting them per children when displayed?
- Trying to WP_Query a category
- How can I only display one link rather than many?
- Is there a reason I cannot get the current category in a loop?
- not all categories being displayed
- How to get parent category ID in single page template
- Hierarchical permalink structure for posts showing categories and sub-categories
- how i can hide some category from author admin panel?
- Category archive is displaying all posts rather than the specific category
- Use the category name instead of category slug in permalinks
- “Item not updated” when try to change category properties
- Show the latest post from child category?
- Two columns in homepage each with one category
- Finding the category id’s on category intersection pages
- Get URL Category Name By ID
- How can I tell what category I’m in– in the header?
- new WP_Query all post in a category inside the loop
- Trying to get variables in hacked category dropdown
- Problem with different query loops (and “main loop”) on category template page!
- How to do paging in the loop?
- How to add orderby parameter for sorting on category.php
- delete category name in the pages
- Show posts in “image” format when viewed in category page, but with comments in blog
- how to separate categories in loop.php?
- query_posts not reading correct categories
- SQL query to return categories and category parents
- Target a specific category from a custom taxonomy?
- How to Remove a Title from All Category and Tags Page?