humanmade / humanmade/smartcache

Incorrect post URLs are used for invalidation when a post moves out of a published state

Open
#7 0 comments 1 reaction 2 assignees Claimed by @rmccue View on GitHub
Dominant language
PHP
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

The hook in `transition_post_status` fires after a post's status has been changed and `get_permalink()` returns the new URL for that post.

When a post is moved from `publish` to `draft` or `trash` or..., `get_permalink()` will return a URL like `https://example.org/?p=1234` instead of the previously public URL that has been page cached.

I'm not sure if there's a clean way to handle this directly in Smartcache. I've worked around it at the project level by statically capturing the post permalink on `pre_post_update`, `wp_trash_post`, and `before_delete_post` and then filtering that in myself as needed via `smartcache.urls_to_invalidate_for_post`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.