#20486 closed defect (bug) (fixed)
Pass full post object to clean_post_cache()
Reported by: | duck_ | Owned by: | duck_ |
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Cache API | Keywords: | |
Focuses: | Cc: |
Attachments (3)
Change History (8)
#2
follow-up:
↓ 3
@
12 years ago
The second patch still contains a few calls that pass a variable called $post_id
through instead of $post
. Is that correct? (or can the variables be renamed to be better self-documenting)
#3
in reply to:
↑ 2
@
12 years ago
Replying to GaryJ:
The second patch still contains a few calls that pass a variable called
$post_id
through instead of$post
. Is that correct? (or can the variables be renamed to be better self-documenting)
Yes. I updated the clean_post_cache() to reflect that it can be int or object. This ticket should be "accept an object in clean_post_cache()" and not "unconditionally switch to passing objects". The only situation that the object is actually necessary is when the cache clean is called after a database delete query when we want the object for its post type so we can ensure that the $taxonomy_relationship
cache is cleaned.
get_post() in clean_post_cache() isn't much of a problem. We just need to check the the result. If it's
empty()
then we can assume the post isn't cached.The recommendation/documentation would be to pass an object though.