Opened 6 months ago
Closed 6 months ago
#63690 closed enhancement (invalid)
Use `comment_cookie_lifetime` filter when removing comment cookies for consistency
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 6.9 |
| Component: | Comments | Keywords: | has-patch needs-testing good-first-bug |
| Focuses: | Cc: |
Description
Currently, the wp_set_comment_cookies() function uses the comment_cookie_lifetime filter only when setting cookies, but not when removing them.
This leads to a minor inconsistency: developers filtering comment_cookie_lifetime may expect the same value to apply in both cases, particularly when setting a past timestamp to delete cookies.
### Proposed Enhancement
This patch ensures consistency by applying the same comment_cookie_lifetime filter when calculating the $past value for cookie removal:
php
$past = time() - apply_filters( 'comment_cookie_lifetime', YEAR_IN_SECONDS );
Attachments (1)
Change History (2)
#1
@
6 months ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Thanks for the report @akshaykungiri but the cookie lifetime has no relevance here because the cookie's expiry date is being set to a date in the past in order to invalidate it. The lifetime doesn't need to be taken into account.
Cheers!
Created patch.