Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent updating transient when just previewing post and prime cache upon post-save #695

Open
westonruter opened this issue Mar 7, 2023 · 0 comments

Comments

@westonruter
Copy link
Owner

Currently the syntax-highlighted markup gets cached in a transient every time a modification is made, unless in development mode:

if ( ! DEVELOPMENT_MODE ) {
set_transient( $transient_key, compact( 'content', 'attributes' ), MONTH_IN_SECONDS );
}

This can cause quite a few throw-away transients to build up in the course of editing a post. I suggest we add an is_preview() to the conditions, so it only caches the result when viewing the post in a non-preview context.

It would also be good to warm the cache upon save_post so that a frontend request is less prone to involve a cache miss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant