﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
12989	Object term cache not updated for custom post types	greenshady	ryan	"I was tinkering around with custom post types with their own custom taxonomies today and realized I had a page with 70+ database queries and only 10 ""posts"" listed, each with 5 term lists.  This was with running file-based caching, so I knew something was wrong.

The problem seemed to be coming from calls to `get_the_term_list()` for the custom taxonomies.  Each time this was called, it was querying the database.  This wouldn't be so bad if we were simply listing 10 ""posts"", each with one call to the `get_the_term_list()`.

`get_the_term_list()` calls `get_the_terms()`, which checks for the object term cache like so:

{{{
$terms = get_object_term_cache( $id, $taxonomy );
}}}

Unfortunately, with custom post types, this ALWAYS returns false.  So, the function must get this information from the database.

After some more digging, I found my way to the `update_post_caches()` function in `wp-includes/post.php`, which is where I think the problem is.  It explicitly says the object type is `post`:

{{{
update_object_term_cache($post_ids, 'post');
}}}

Making a quick change of `post` to `ticket` (my custom post type) and a page refresh fixed my database query issue.

I may be off base about where the problem originates but this seems to be it.  I tried to dig as deep as I could on this one and provide the necessary steps.  "	defect (bug)	closed	normal	3.0	Cache	3.0	normal	fixed	has-patch dev-reviewed	
