Opened 14 months ago
Closed 14 months ago
#20486 closed defect (bug) (fixed)
Pass full post object to clean_post_cache()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Cache | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Attachments (3)
Change History (7)
comment:2
follow-up:
↓ 3
GaryJ
— 14 months 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)
comment:3
in reply to:
↑ 2
duck_
— 14 months 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.