Skip to content

Allow max-age=0 value#307

Open
kpoelhekke wants to merge 1 commit intowp-graphql:mainfrom
kpoelhekke:main
Open

Allow max-age=0 value#307
kpoelhekke wants to merge 1 commit intowp-graphql:mainfrom
kpoelhekke:main

Conversation

@kpoelhekke
Copy link
Copy Markdown

Problem

  • Setting max_age_header to 0 didn’t take effect.
  • Reasons:
    1. WordPress treats taxonomy term name 0 as empty → value wasn’t saved.
    2. Header logic used truthy checks, so 0 was ignored when computing/setting headers (including batch min selection).

Fix

  • Store zero using a sentinel term name zero so it persists; map back to integer 0 on read.

File

  • wp/plugins/wpgraphql-smart-cache/src/Document/MaxAge.php

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

Successfully merging this pull request may close these issues.

1 participant