WordPress will cache all terms for taxonomies attached to all post types in the query result set by default – well, so long as you haven’t set either cache_results
or update_post_term_cache
to false
(codex).
So calling get_the_terms
etc. within the loop will not hit the database. However, wp_get_object_terms
will hit the database as it by-passes WordPress’ object cache.
Related Posts:
- Why is my WP_Query not working when tax_query terms are an array?
- How to add terms to my tax_query based off of the current post
- Pass array of taxonomy terms to wp_query
- Formulate a url to show posts with both taxonomy terms
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Order by slug in get_terms with multiple taxonomies
- Function get_queried_object() return NULL in custom taxonomy
- Get authors by term id or slug
- Taxonomy order exception for specific term
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- How to add custom meta to ‘pre_get_terms’?
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- How to get posts by category and by choosing a taxonomy term?
- 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?
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Only show tag with the same id as the post
- Save queried result into database
- taxquery taxonomy get terms
- How to show terms from another taxonomy
- How to define a custom hierarchy for terms?
- tax_query not working properly with get_posts
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Need help with Query Loop. Need to get current taxonomy term and its posts and group them by a different selected taxonomy term
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- How to use the_posts_navigation for wp_query and get_posts?
- WP_Query vs get_posts
- tax_query in get_posts() not working?
- Show posts without term
- meta_query: using BETWEEN with floats and/or casting to DECIMAL
- Get posts from Network (Multisite)
- How to order by post_status?
- Using get_posts vs. WP_Query
- Delete all posts from WordPress except latest X posts
- WP query taxonomy input differs to output?
- Search custom taxonomy term by name
- Sanitation needed for WP_Query or get_posts calls?
- Differences Between WP_Query() and get_posts() for Querying Posts?
- Get Recent Posts by Date in Multisite
- get_posts with multiple categories
- get_template_part in for loop
- Use of caller_ get_ posts
- How to display post from current Taxonomy in archive page?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- How-to exclude terms from the main query the most performant way?
- Display posts the match taxonomy term linked from wp_list_categoies?
- Is it possible to select against a post’s parent’s fields with WP_Query?
- Query all posts where meta value is empty
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- Get posts by meta data OR title
- Get_post() with meta_key when compare is a date
- get_posts not finding argument: post_name
- Meta Query with date and time on the same Day before given time
- Get posts with condition on comment meta value
- Function to check if author has posted within the last x days
- Move posts to top of WP_Query if in certain Taxonomy?
- Use post__in and post__not_in together?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- What should I use, get_posts or wp_query for less CPU load?
- Different Results with query(‘s=computer’) vs get_posts(‘s=computer’)?
- Display certain amount of posts on taxonomy archive page
- Querying Multiple Custom Taxonomy Terms
- How to get post from all Blog Multisite to the Main Site?
- List taxonomy terms plus their latest post ordered by post date
- WP Query post meta value
- Get random terms
- Get all posts without tags
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- get_posts() seemingly ignoring post_type
- Can not switch the queried post in pre_get_posts hook
- Get posts that matches specific terms of multiple custom taxonomies
- Order terms inside a select dropdown
- How to find out what “Blog pages show at most” is set to [duplicate]
- Filter and list posts of a custom taxonomy
- Count posts returned by get_posts in external PHP script
- List all custom post type posts from a given category?
- WP Query – Get WooCommerce Products with variation that is in stock
- Trying to check and see if a post has a featured image outside of the main loop
- WP_query category__in not working, only pulls from first category
- Filter WordPress posts by between parameter
- How to Modify Taxonomy Archive Page with Search Parameter?
- Get array of current post term ID’s
- SELECT * FROM $wpdb->posts WHERE ID > 160
- Filtering posts by custom field value not working
- Change default ordering of taxonomy terms – pre_get_terms
- Display link to taxonomy archive only if it has posts with certain custom field values
- Adding multiple post queries with parent and children to page – Best Way
- How do you Query posts with nothing in common?
- WP_Query, tax_query and term_meta: How to?
- Order taxonomy terms in alphabetical order
- Is it possible to dynamically get queried term AND taxonomy?
- WP Query for variable taxonomies
- Empty tax_query array returns an empty array
- How do I search inside specific taxonomies in WordPress
- Get taxonomy terms only of the WP_Query current posts
- Get posts for last working week in WP_Query
- Get list of terms that have posts in another term
- get_posts – get all posts by array of author