This is possible, but there’s not a “neat” way to do it. There’s a great write-up here:
Display the Most Recent Post in Each Category
but as the author points out, it’s a separate query to get the most recent posts for each term. To his great credit, he does deal with caching them, which will help tremendously with the load this would place on your database / server.
Related Posts:
- WordPress Paginate $wpdb->get_results
- $wpdb->replace: WHERE?
- Custom select query two tables by a meta key
- Fastest and most efficient SQL query to check if UID exists
- What SQL Query to do a simple find and replace
- Custom Search Query
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- wpdb get posts by taxonomy SQL
- Multipart/formatted MySQL query problem
- How to make an activities stream mixing posts and comments?
- Can I use $wpdb for my custom tables in the WordPress database?
- Create subpage /user/ or /my-profile/ like /author/ with additional query like /user/user123
- Retrieve and display data from custom db table in admin area?
- How to find if a post with custom_field == X exists?
- Custom search page and search by title, content and tag
- Modifying loop on a custom page, strange behaviour
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- What’s the proper way to use a custom table? [closed]
- Why would switch_to_blog stop working?
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- How to correctly pass values to wpdb->prepare()?
- What’s wrong with my $wpdb prepare?
- Get stock by custom meta field on all Woocommerce variable products
- How I display post of the post type group by year of post?
- Load more posts with multiple queries
- Hi, I wanted to make custom search with multiple fields
- The function can not create a table on MariaDB server
- wp_query get post custom taxonomy in search.php
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- Include data from custom table in WP_Query
- $wpdb->insert running multiple times?
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- wpdb custom tables without plugin
- Order posts with a custom field but also without
- wpdb query problem to access previous 3 days posts
- WordPress Custom post query sorting does not work
- Save title as custom field on custom post type
- I can’t figure out what’s wrong with this statement. $wpdb->query update
- Add content in between of foreach
- Custom Loop Query For Search Page
- Custom Query – Based on user input
- Custom SELECT Query With Multiple Meta Values (Ordering Problem)
- PHP -> SQL Query with Summing
- Query for specific custom field
- $wpdb->prepare affecting the query?
- prepare function sql safe method
- Display posts by combining multiple meta key
- Why my query does not run with prepare
- Custom Same Page Search
- Fatal error Call to a member function insert() on a non-object [closed]
- custom user meta query
- How do I query for posts by custom meta and those that have been stickied?
- SQL query to get posts from multiple categories but not in a category
- Recent activity query WordPress
- How to query term_id of a Custom Taxonomy by name
- Troubles about insering a POST with a SQL query, post_status
- WP Search Form Query: Add Author’s posts into search query
- query variables for custom taxonomies
- display text generated via custom get query string
- Customising the default wordpress search functionality
- What is my error trying to create a new table in the database?
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Delete oldest wordpress post (SQL query)
- Custom query pagination with php parameter as arg problem
- How to have differents sites share the same tables of DB?
- How to automatically pull an information from a form field onto an other page?
- Query Posts to display all posts with category “custom field value”
- Add commentmeta custom field to every published comment with SQL
- Query 1 custom post type, each day, alphabetically
- $wpdb query for price in custom field value
- Run an update query in a function
- Pre_Get_Posts order DESC not registering
- Multiple Taxonomies Using Custom SQL Query
- Wpdb generates too many queries
- get_var result empty for query of custom table in plugin admin
- Search a meta field for a value in all posts
- Special Query: Title, Terms, Content – %LIKE%
- Custom MySQL query to list post
- Custom Query Arguments
- pull custom fields values from wp-database in a nested foreach loop
- Custom Query for Taxonomy
- Include plugin´s table in custom query
- User Query Multiple Orderby Clause
- Has the table name in SQL for WordPress changed from WP_posts to WPCS_post?
- wp_trim_words() does not trim the_content() in WordPress
- Gallery Shortcode: using link attribute to link to a specific image size
- Limit comments displayed on basis of user_id
- Are database queries created using WordPress filters protected from SQL injection?
- How to display post title & excerpt when mouse hovers on an image?
- Can’t receive $args[ ] to my custom widget
- Customizing Users in Admin Area
- CREATE TABLE with dbDelta does not create table
- get_delete_post_link( $post->ID ) is blank when logged in as “subscriber”
- insert post fails after multiple postings
- A delete/trash all function?
- Creates only one table and not the other
- Unable to show messages using ‘admin_notices’
- How can I add a Description column to the media library browser screen?
- Changes in comments.php in the child theme does not show up on the site
- how to modify request to get_template_part()?