Commit ea3ed36
authored
Fix: normalize $post_id and skip id 0 in post edit/change cache hooks (#1070)
wp_cache_post_edit() and wp_cache_post_change() assumed $post_id was
always an integer. Defensively normalize a WP_Post object down to its
ID, cast to int, and bail out early when the id is 0 so a stray
zero-id invalidation can't wipe the front-page/root cache.
Refs #9591 parent 8aa4714 commit ea3ed36
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3287 | 3287 | | |
3288 | 3288 | | |
3289 | 3289 | | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
3290 | 3300 | | |
3291 | 3301 | | |
3292 | 3302 | | |
| |||
3360 | 3370 | | |
3361 | 3371 | | |
3362 | 3372 | | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
3363 | 3383 | | |
3364 | 3384 | | |
3365 | 3385 | | |
| |||
0 commit comments